aboutsummaryrefslogtreecommitdiff
path: root/src/utils/dbg_log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/dbg_log.h')
-rw-r--r--src/utils/dbg_log.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h
index 2467983..e5b3e24 100644
--- a/src/utils/dbg_log.h
+++ b/src/utils/dbg_log.h
@@ -1,10 +1,11 @@
1#include <stdio.h> 1#include <stdio.h>
2 2
3void (*nissy_log)(const char *); 3void (*nissy_log)(const char *, void *);
4void write_wrapper(void (*)(const char *), const char *, ...); 4void *nissy_log_data;
5void write_wrapper(void (*)(const char *, void *), const char *, ...);
5 6
6void 7void
7write_wrapper(void (*write)(const char *), const char *str, ...) 8write_wrapper(void (*write)(const char *, void *), const char *str, ...)
8{ 9{
9 static const size_t len = 1000; 10 static const size_t len = 1000;
10 char message[len]; 11 char message[len];
@@ -14,7 +15,7 @@ write_wrapper(void (*write)(const char *), const char *str, ...)
14 vsprintf(message, str, args); 15 vsprintf(message, str, args);
15 va_end(args); 16 va_end(args);
16 17
17 write(message); 18 write(message, nissy_log_data);
18} 19}
19 20
20#define LOG(...) if (nissy_log != NULL) write_wrapper(nissy_log, __VA_ARGS__); 21#define LOG(...) if (nissy_log != NULL) write_wrapper(nissy_log, __VA_ARGS__);

Generated with cgit - Back to sebastiano.tronto.net