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=
This commit is contained in:
Barnabás Pőcze 2023-02-14 00:17:00 +01:00 committed by Wim Taymans
parent 58812103f3
commit 2b6541f503
2 changed files with 6 additions and 0 deletions

View file

@ -22,6 +22,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <stddef.h>
#include <unistd.h>
#include <string.h>
@ -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);
}

View file

@ -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')