diff --git a/spa/plugins/support/logger.c b/spa/plugins/support/logger.c index 9a20ff241..7d0b14c1f 100644 --- a/spa/plugins/support/logger.c +++ b/spa/plugins/support/logger.c @@ -2,12 +2,16 @@ /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */ /* SPDX-License-Identifier: MIT */ +#include "config.h" + #include +#include #include #include #include #include #include +#include #include #include @@ -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;