]> code.delx.au - pulseaudio/commitdiff
log: add thread name
authorLu Guanqun <guanqun.lu@intel.com>
Mon, 8 Aug 2011 02:24:13 +0000 (10:24 +0800)
committerColin Guthrie <colin@mageia.org>
Tue, 9 Aug 2011 13:06:01 +0000 (15:06 +0200)
This patch displays thread name in the log, that would be more descriptive.
It improves Xingchao (xingchao.wang@intel.com)'s patch which shows thread id.

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
src/pulsecore/log.c

index 13038148caff7db2dcc4eaa9ec5c44b7cfc7fcd9..e2721ac07260870ceab168386130162401b401da 100644 (file)
@@ -302,9 +302,9 @@ void pa_log_levelv_meta(
     pa_vsnprintf(text, sizeof(text), format, ap);
 
     if ((_flags & PA_LOG_PRINT_META) && file && line > 0 && func)
-        pa_snprintf(location, sizeof(location), "[%s:%i %s()] ", file, line, func);
+        pa_snprintf(location, sizeof(location), "[%s][%s:%i %s()] ", pa_thread_get_name(pa_thread_self()), file, line, func);
     else if ((_flags & (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE)) && file)
-        pa_snprintf(location, sizeof(location), "%s: ", pa_path_get_filename(file));
+        pa_snprintf(location, sizeof(location), "[%s] %s: ", pa_thread_get_name(pa_thread_self()), pa_path_get_filename(file));
     else
         location[0] = 0;