about summary refs log tree commit diff stats
path: root/src/include/debug.h
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-02-14 20:10:32 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-02-14 20:10:32 +0100
commitc74c9bd693df180f2f9fb021d3ffddaa8e34f975 (patch)
tree556db4993d1272836349ba8613240ef1b0ce7f08 /src/include/debug.h
parent1daf15c525fbe982fdde7f35e6e9a900943fe3dc (diff)
downloadbox64-c74c9bd693df180f2f9fb021d3ffddaa8e34f975.tar.gz
box64-c74c9bd693df180f2f9fb021d3ffddaa8e34f975.zip
Refactored trace to file system, to be more resiliant
Diffstat (limited to 'src/include/debug.h')
-rwxr-xr-xsrc/include/debug.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/include/debug.h b/src/include/debug.h
index 3f3a041b..ed729868 100755
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -72,15 +72,15 @@ extern int box64_tcmalloc_minimal;  // when using tcmalloc_minimal
 #define LOG_NEVER 3
 #define LOG_VERBOSE 3
 
-extern FILE* ftrace;
+void printf_ftrace(const char* fmt, ...);
 
-#define printf_log(L, ...) do {if((L)<=box64_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0)
+#define printf_log(L, ...) do {if((L)<=box64_log) {printf_ftrace(__VA_ARGS__);}} while(0)
 
-#define printf_dump(L, ...) do {if(box64_dump || ((L)<=box64_log)) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0)
+#define printf_dump(L, ...) do {if(box64_dump || ((L)<=box64_log)) {printf_ftrace(__VA_ARGS__);}} while(0)
 
-#define printf_dlsym(L, ...) do {if(dlsym_error || ((L)<=box64_log)) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0)
+#define printf_dlsym(L, ...) do {if(dlsym_error || ((L)<=box64_log)) {printf_ftrace(__VA_ARGS__);}} while(0)
 
-#define dynarec_log(L, ...) do {if((L)<=box64_dynarec_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0)
+#define dynarec_log(L, ...) do {if((L)<=box64_dynarec_log) {printf_ftrace(__VA_ARGS__);}} while(0)
 
 #define EXPORT __attribute__((visibility("default")))
 #ifdef BUILD_DYNAMIC