mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 13:32:29 +00:00
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:
parent
d019038427
commit
2d26569296
3 changed files with 52 additions and 16 deletions
|
@ -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>
|
2006-08-18 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* docs/random/ensonic/logging.txt:
|
* docs/random/ensonic/logging.txt:
|
||||||
|
|
|
@ -23,18 +23,18 @@ function -----------------------------------------------------------------------
|
||||||
message -----------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
|
message -----------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
new proposed format:
|
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
|
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
|
||||||
log_level_name --^^^^^ | | | | | | | | | | | | |
|
timestamp -------^^^^^^^^^^^^^^^^^ | | | | | | | | | | | | |
|
||||||
log_category ------------------------^^^^^^^| | | | | | | | | | |
|
process-id ------------------------^^^^^ | | | | | | | | | | |
|
||||||
process-id ----------------------------------^^^^^ | | | | | | | | |
|
thread-id -------------------------------^^^^^^^^^ | | | | | | | | |
|
||||||
thread-id -------------------------------------------^^^^^^^^^ | | | | | | |
|
log_level_name ------------------------------------^^^^^ | | | | | | |
|
||||||
timestamp -------------------------------------------------------^^^^^^^^^^^^^^^^^ | | | | |
|
log_category ----------------------------------------------------------^^^^^^^ | | | | |
|
||||||
file:line -------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^ | | |
|
file:line ---------------------------------------------------------------------^^^^^^^^^^^^^^^^^^ | | |
|
||||||
function ----------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
function -----------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
||||||
message -----------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
|
message ------------------------------------------------------------------------------------------------------------------------^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
something like:
|
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'.
|
should make logs easily 'diffable'.
|
||||||
|
|
||||||
== color code level ==
|
== color code level ==
|
||||||
|
@ -47,3 +47,10 @@ DEBUG : turkis
|
||||||
LOG : gray
|
LOG : gray
|
||||||
NONE : gray
|
NONE : gray
|
||||||
|
|
||||||
|
== log sources ==
|
||||||
|
|
||||||
|
What about differentating between log sources:
|
||||||
|
core
|
||||||
|
elements
|
||||||
|
application
|
||||||
|
|
||||||
|
|
|
@ -618,11 +618,20 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
||||||
gchar *clear;
|
gchar *clear;
|
||||||
gchar *obj = NULL;
|
gchar *obj = NULL;
|
||||||
gchar pidcolor[10];
|
gchar pidcolor[10];
|
||||||
|
const gchar *levelcolor;
|
||||||
gint pid;
|
gint pid;
|
||||||
GTimeVal now;
|
GTimeVal now;
|
||||||
GstClockTime elapsed;
|
GstClockTime elapsed;
|
||||||
gboolean free_color = TRUE;
|
gboolean free_color = TRUE;
|
||||||
gboolean free_obj = 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))
|
if (level > gst_debug_category_get_threshold (category))
|
||||||
return;
|
return;
|
||||||
|
@ -635,11 +644,13 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
||||||
(category));
|
(category));
|
||||||
clear = "\033[00m";
|
clear = "\033[00m";
|
||||||
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
|
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
|
||||||
|
levelcolor = levelcolormap[level];
|
||||||
} else {
|
} else {
|
||||||
color = "\0";
|
color = "\0";
|
||||||
free_color = FALSE;
|
free_color = FALSE;
|
||||||
clear = "";
|
clear = "";
|
||||||
pidcolor[0] = '\0';
|
pidcolor[0] = '\0';
|
||||||
|
levelcolor = "\0";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object) {
|
if (object) {
|
||||||
|
@ -651,12 +662,21 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
||||||
|
|
||||||
g_get_current_time (&now);
|
g_get_current_time (&now);
|
||||||
elapsed = GST_TIMEVAL_TO_TIME (now) - start_time;
|
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_debug_level_get_name (level), g_thread_self (),
|
||||||
GST_TIME_ARGS (elapsed), color,
|
GST_TIME_ARGS (elapsed), color,
|
||||||
gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
|
gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
|
||||||
color, file, line, function, obj, clear, gst_debug_message_get (message));
|
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)
|
if (free_color)
|
||||||
g_free (color);
|
g_free (color);
|
||||||
|
|
Loading…
Reference in a new issue