aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'CommonLibs/debug.h')
-rw-r--r--CommonLibs/debug.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/CommonLibs/debug.h b/CommonLibs/debug.h
index a5b9271..760ab32 100644
--- a/CommonLibs/debug.h
+++ b/CommonLibs/debug.h
@@ -1,5 +1,10 @@
#pragma once
+#include <stdbool.h>
+#include <pthread.h>
+
+#include <osmocom/core/logging.h>
+
extern const struct log_info log_info;
/* Debug Areas of the code */
@@ -9,3 +14,22 @@ enum {
DDEV,
DLMS,
};
+
+
+bool log_mutex_init();
+void log_mutex_lock();
+void log_mutex_unlock();
+void log_mutex_lock_canceldisable(int *st);
+void log_mutex_unlock_canceldisable(int st);
+
+#define CLOGC(category, level, fmt, args...) do { \
+ log_mutex_lock(); \
+ LOGP(category, level, "[tid=%lu] " fmt, pthread_self(), ##args); \
+ log_mutex_unlock(); \
+} while(0)
+
+#define CLOGCHAN(chan, category, level, fmt, args...) do { \
+ log_mutex_lock(); \
+ LOGP(category, level, "[tid=%lu][chan=%lu] " fmt, pthread_self(), chan, ##args); \
+ log_mutex_unlock(); \
+} while(0)