Browse Source

Drop logging pthread ID

new libosmocore osmo-trx already depends on does support printing thread
ID as prefix to all messages (confgiurable through VTY), so there's no
use in printing it in osmo-trx unconditionally.

Moreover, The type used to represent a thread ID is implementation
specific, and may be an opaqe structure, making it unsuitable to be
printed by standard means, so in any case we should be better printing
system's TID instead.

Related: OS#5032
Change-Id: Ie98a21246230c946afc47f4f5b9c6618eefde494
changes/60/23160/2
Pau Espin 1 year ago
parent
commit
d06259f348
  1. 10
      CommonLibs/Logger.h
  2. 7
      CommonLibs/debug.h

10
CommonLibs/Logger.h

@ -50,19 +50,19 @@ extern "C" {
#endif
#define LOG(level) \
Log(DMAIN, LOGL_##level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "] "
Log(DMAIN, LOGL_##level, __BASE_FILE__, __LINE__).get()
#define LOGC(category, level) \
Log(category, LOGL_##level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "] "
Log(category, LOGL_##level, __BASE_FILE__, __LINE__).get()
#define LOGLV(category, level) \
Log(category, level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "] "
Log(category, level, __BASE_FILE__, __LINE__).get()
#define LOGSRC(category, level, file, line) \
Log(category, level, file, line).get() << "[tid=" << pthread_self() << "] "
Log(category, level, file, line).get()
#define LOGCHAN(chan, category, level) \
Log(category, LOGL_##level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "][chan=" << chan << "] "
Log(category, LOGL_##level, __BASE_FILE__, __LINE__).get() << "[chan=" << chan << "] "
/**
A C++ stream-based thread-safe logger.

7
CommonLibs/debug.h

@ -3,7 +3,6 @@
#include <stdbool.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/thread.h>
extern const struct log_info log_info;
@ -19,10 +18,6 @@ enum {
DCTR,
};
#define CLOGC(category, level, fmt, args...) do { \
LOGP(category, level, "[tid=%ld] " fmt, (long int) osmo_gettid(), ##args); \
} while(0)
#define CLOGCHAN(chan, category, level, fmt, args...) do { \
LOGP(category, level, "[tid=%ld][chan=%zu] " fmt, (long int) osmo_gettid(), chan, ##args); \
LOGP(category, level, "[chan=%zu] " fmt, chan, ##args); \
} while(0)

Loading…
Cancel
Save