about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-22 02:08:09 +0800
committerGitHub <noreply@github.com>2025-01-21 19:08:09 +0100
commit314edea645acacf03930af17aa01783ca735306a (patch)
tree8b6379b6bece743b38e4b3dc88fbdc6a869d4fc6 /src/include
parentfe28bd93bd2ddf2737960cea84ff406a3f3922dc (diff)
downloadbox64-314edea645acacf03930af17aa01783ca735306a.tar.gz
box64-314edea645acacf03930af17aa01783ca735306a.zip
Added [BOX64] prefix for all the stdout logs (#2279)
* Added [BOX64] prefix for all the stdout logs

* Remove some hardcoded prefix

* review
Diffstat (limited to 'src/include')
-rw-r--r--src/include/debug.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/include/debug.h b/src/include/debug.h
index 36a2e14a..0510d7fe 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -67,24 +67,35 @@ extern int box64_tcmalloc_minimal;  // when using tcmalloc_minimal
 #define LOG_NEVER 3
 #define LOG_VERBOSE 3
 
-void printf_ftrace(const char* fmt, ...);
+void printf_ftrace(int prefix, const char* fmt, ...);
 
-#define printf_log(L, ...)                                        \
-    do {                                                          \
-        if ((L) <= BOX64ENV(log)) { printf_ftrace(__VA_ARGS__); } \
+#define printf_log_prefix(prefix, L, ...)                                 \
+    do {                                                                  \
+        if ((L) <= BOX64ENV(log)) { printf_ftrace(prefix, __VA_ARGS__); } \
     } while (0)
 
-#define printf_dump(L, ...)                                                           \
-    do {                                                                              \
-        if (BOX64ENV(dump) || ((L) <= BOX64ENV(log))) { printf_ftrace(__VA_ARGS__); } \
+#define printf_log(L, ...) printf_log_prefix(1, L, __VA_ARGS__)
+
+#define printf_dump_prefix(prefix, L, ...)                                                    \
+    do {                                                                                      \
+        if (BOX64ENV(dump) || ((L) <= BOX64ENV(log))) { printf_ftrace(prefix, __VA_ARGS__); } \
     } while (0)
 
-#define printf_dlsym(L, ...)                                                                 \
-    do {                                                                                     \
-        if (BOX64ENV(dlsym_error) || ((L) <= BOX64ENV(log))) { printf_ftrace(__VA_ARGS__); } \
+#define printf_dump(L, ...) printf_dump_prefix(1, L, __VA_ARGS__)
+
+#define printf_dlsym_prefix(prefix, L, ...)                                                          \
+    do {                                                                                             \
+        if (BOX64ENV(dlsym_error) || ((L) <= BOX64ENV(log))) { printf_ftrace(prefix, __VA_ARGS__); } \
+    } while (0)
+
+#define printf_dlsym(L, ...) printf_dlsym_prefix(1, L, __VA_ARGS__)
+
+#define dynarec_log_prefix(prefix, L, ...)                                        \
+    do {                                                                          \
+        if ((L) <= BOX64ENV(dynarec_log)) { printf_ftrace(prefix, __VA_ARGS__); } \
     } while (0)
 
-#define dynarec_log(L, ...) do {if((L)<=BOX64ENV(dynarec_log)) {printf_ftrace(__VA_ARGS__);}} while(0)
+#define dynarec_log(L, ...) dynarec_log_prefix(1, L, __VA_ARGS__)
 
 #define EXPORT __attribute__((visibility("default")))
 #ifdef BUILD_DYNAMIC