[vlc-commits] messages: add thread ID in message meta-data

Rémi Denis-Courmont git at videolan.org
Wed May 25 22:06:56 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 25 23:00:50 2016 +0300| [d838f848d613ba784fc1f076fc6131be9d252802] | committer: Rémi Denis-Courmont

messages: add thread ID in message meta-data

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d838f848d613ba784fc1f076fc6131be9d252802
---

 include/vlc_messages.h   |    1 +
 modules/logger/journal.c |    1 +
 src/misc/messages.c      |    1 +
 3 files changed, 3 insertions(+)

diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index f5b23b2..68121ea 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -61,6 +61,7 @@ typedef struct vlc_log_t
     const char *file; /**< Source code file name or NULL */
     int line; /**< Source code file line number or -1 */
     const char *func; /**< Source code calling function name or NULL */
+    unsigned long tid; /**< Emitter thread ID */
 } vlc_log_t;
 
 VLC_API void vlc_Log(vlc_object_t *obj, int prio, const char *module,
diff --git a/modules/logger/journal.c b/modules/logger/journal.c
index 0bddfd6..bafb7b7 100644
--- a/modules/logger/journal.c
+++ b/modules/logger/journal.c
@@ -52,6 +52,7 @@ static void Log(void *opaque, int type, const vlc_log_t *meta,
         "CODE_LINE=%u", meta->line,
         "CODE_FUNC=%s", (meta->func != NULL) ? meta->func : "",
         //"ERRNO=%d"
+        "VLC_TID=%lu" /* change to OBJECT_TID if standardized */, meta->tid,
         "VLC_OBJECT_ID=%"PRIxPTR, meta->i_object_id,
         "VLC_OBJECT_TYPE=%s", meta->psz_object_type,
         "VLC_MODULE=%s", meta->psz_module,
diff --git a/src/misc/messages.c b/src/misc/messages.c
index b838bdd..5a69110 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -118,6 +118,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
     msg.file = file;
     msg.line = line;
     msg.func = func;
+    msg.tid = vlc_thread_id();
 
     for (vlc_object_t *o = obj; o != NULL; o = o->p_parent)
         if (o->psz_header != NULL)



More information about the vlc-commits mailing list