mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-25 09:05:57 -04:00
Merge branch 'spa_support_logger_tid' into 'master'
spa: support: logger: print thread id for each message See merge request pipewire/pipewire!2748
This commit is contained in:
commit
40c330c3c8
1 changed files with 12 additions and 0 deletions
|
|
@ -2,12 +2,16 @@
|
|||
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <threads.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
|
|
@ -92,6 +96,14 @@ impl_log_logtv(void *object,
|
|||
|
||||
spa_strbuf_append(&msg, "%s[%s]", prefix, levels[level]);
|
||||
|
||||
#ifdef HAVE_GETTID
|
||||
static thread_local pid_t tid;
|
||||
if (SPA_UNLIKELY(tid == 0))
|
||||
tid = gettid();
|
||||
|
||||
spa_strbuf_append(&msg, "[%jd]", (intmax_t) tid);
|
||||
#endif
|
||||
|
||||
if (impl->local_timestamp) {
|
||||
char buf[64];
|
||||
struct timespec now;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue