From 2b6541f5034291f8c0d8980fada0c47eda4e6ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 14 Feb 2023 00:17:00 +0100 Subject: [PATCH] spa: support: send TID to systemd journal Knowing which thread posted which log message can be useful, so send the TID to the systemd journal. The `TID` field is explicitly listed on https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#TID= --- spa/plugins/support/journal.c | 5 +++++ spa/plugins/support/meson.build | 1 + 2 files changed, 6 insertions(+) diff --git a/spa/plugins/support/journal.c b/spa/plugins/support/journal.c index e0e58ebeb..463db2c61 100644 --- a/spa/plugins/support/journal.c +++ b/spa/plugins/support/journal.c @@ -22,6 +22,8 @@ * DEALINGS IN THE SOFTWARE. */ +#include "config.h" + #include #include #include @@ -114,6 +116,9 @@ impl_log_logtv(void *object, sd_journal_send_with_location(file_buffer, line_buffer, func, "MESSAGE=%s", message_buffer, "PRIORITY=%i", priority, +#ifdef HAVE_GETTID + "TID=%jd", (intmax_t) gettid(), +#endif NULL); } diff --git a/spa/plugins/support/meson.build b/spa/plugins/support/meson.build index bc7ebbad5..784b21e02 100644 --- a/spa/plugins/support/meson.build +++ b/spa/plugins/support/meson.build @@ -61,6 +61,7 @@ if systemd_dep.found() spa_journal_lib = shared_library('spa-journal', spa_journal_sources, + include_directories : [ configinc ], dependencies : [ spa_dep, systemd_dep ], install : true, install_dir : spa_plugindir / 'support')