docs/random/ensonic/logging.txt: update ideas

Original commit message from CVS:
* docs/random/ensonic/logging.txt:
update ideas
* gst/gstinfo.c: (gst_debug_log_default):
reorder fields, save some columns, add optinal color codes for log-
levels
This commit is contained in:
Stefan Kost 2006-08-18 10:52:33 +00:00
parent d019038427
commit 2d26569296
3 changed files with 52 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2006-08-18 Stefan Kost <ensonic@users.sf.net>
* docs/random/ensonic/logging.txt:
update ideas
* gst/gstinfo.c: (gst_debug_log_default):
reorder fields, save some columns, add optinal color codes for log-
levels
2006-08-18 Stefan Kost <ensonic@users.sf.net>
* docs/random/ensonic/logging.txt:

View file

@ -23,18 +23,18 @@ function -----------------------------------------------------------------------
message -----------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
new proposed format:
DEBUG GST_QOS( 3340 - 0x8134bc0 - 0:00:00.848191000) gstbasesink.c:1431:gst_base_sink_do_render_stats:<xvimagesink0> avg_render: 0:00:00.009044000
log_level_name --^^^^^ | | | | | | | | | | | | |
log_category ------------------------^^^^^^^| | | | | | | | | | |
process-id ----------------------------------^^^^^ | | | | | | | | |
thread-id -------------------------------------------^^^^^^^^^ | | | | | | |
timestamp -------------------------------------------------------^^^^^^^^^^^^^^^^^ | | | | |
file:line -------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^ | | |
function ----------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
message -----------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
0:00:00.848191000 3340 0x8134bc0 DEBUG GST_QOS gstbasesink.c:1431:gst_base_sink_do_render_stats:<xvimagesink0> avg_render: 0:00:00.009044000
timestamp -------^^^^^^^^^^^^^^^^^ | | | | | | | | | | | | |
process-id ------------------------^^^^^ | | | | | | | | | | |
thread-id -------------------------------^^^^^^^^^ | | | | | | | | |
log_level_name ------------------------------------^^^^^ | | | | | | |
log_category ----------------------------------------------------------^^^^^^^ | | | | |
file:line ---------------------------------------------------------------------^^^^^^^^^^^^^^^^^^ | | |
function -----------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
message ------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
something like:
sed -e "s/([0-9xa-f:. -]*) / /" -e "s/0x[0-9a-f]\{7,8\}//g"
cut -c35- | sed -e "s/0x[0-9a-f]\{7,8\}//g"
should make logs easily 'diffable'.
== color code level ==
@ -47,3 +47,10 @@ DEBUG : turkis
LOG : gray
NONE : gray
== log sources ==
What about differentating between log sources:
core
elements
application

View file

@ -618,11 +618,20 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
gchar *clear;
gchar *obj = NULL;
gchar pidcolor[10];
const gchar *levelcolor;
gint pid;
GTimeVal now;
GstClockTime elapsed;
gboolean free_color = TRUE;
gboolean free_obj = TRUE;
static const gchar *levelcolormap[] = {
"\033[37m", /* GST_LEVEL_NONE */
"\033[31;01m", /* GST_LEVEL_ERROR */
"\033[33;01m", /* GST_LEVEL_WARNING */
"\033[32;01m", /* GST_LEVEL_INFO */
"\033[36m", /* GST_LEVEL_DEBUG */
"\033[37m" /* GST_LEVEL_LOG */
};
if (level > gst_debug_category_get_threshold (category))
return;
@ -635,11 +644,13 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
(category));
clear = "\033[00m";
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
levelcolor = levelcolormap[level];
} else {
color = "\0";
free_color = FALSE;
clear = "";
pidcolor[0] = '\0';
levelcolor = "\0";
}
if (object) {
@ -651,12 +662,21 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
g_get_current_time (&now);
elapsed = GST_TIMEVAL_TO_TIME (now) - start_time;
g_printerr ("%s (%p - %" GST_TIME_FORMAT
") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
/*
g_printerr ("%s (%p - %" GST_TIME_FORMAT ") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
gst_debug_level_get_name (level), g_thread_self (),
GST_TIME_ARGS (elapsed), color,
gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
color, file, line, function, obj, clear, gst_debug_message_get (message));
*/
g_printerr ("%" GST_TIME_FORMAT
" %s%5d%s %p %s%s%s %s%20s %s:%d:%s:%s%s %s\n", GST_TIME_ARGS (elapsed),
pidcolor, pid, clear, g_thread_self (), levelcolor,
gst_debug_level_get_name (level), clear, color,
gst_debug_category_get_name (category), file, line, function, obj, clear,
gst_debug_message_get (message));
if (free_color)
g_free (color);