gstinfo: colorize PIDs in log messages

The PIDs on log lines were supposed to be colorized before, but the
escape sequence was incorrect.  With this change, the code uses the
correct sequence to colorize those PIDs.  E.g., instead of `\033[334m`
(incorrect), use `\033[34m` (correct).

This makes the log messages easier to read.  It also reduces the chance
that a buggy terminal will choke on the invalid escape sequence.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/624

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/689>
This commit is contained in:
Chris White 2020-10-31 15:10:23 -04:00
parent f6ce1686f1
commit e74040b41e

View file

@ -1278,7 +1278,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
color = gst_debug_construct_term_color (gst_debug_category_get_color
(category));
clear = "\033[00m";
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
g_sprintf (pidcolor, "\033[%02dm", pid % 6 + 31);
levelcolor = levelcolormap[level];
#define PRINT_FMT " %s"PID_FMT"%s "PTR_FMT" %s%s%s %s"CAT_FMT"%s %s\n"