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.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h
index f9b1d8a..c30993a 100644
--- a/src/utils/dbg_log.h
+++ b/src/utils/dbg_log.h
@@ -1,6 +1,23 @@
1void (*nissy_log)(const char *, ...); 1#include <stdio.h>
2 2
3#define LOG(...) if (nissy_log != NULL) nissy_log(__VA_ARGS__); 3void (*nissy_log)(const char *);
4void write_wrapper(void (*)(const char *), const char *, ...);
5
6void
7write_wrapper(void (*write)(const char *), const char *str, ...)
8{
9 static const size_t len = 1000;
10 char message[len];
11 va_list args;
12
13 va_start(args, str);
14 sprintf(message, str, args);
15 va_end(args);
16
17 write(message);
18}
19
20#define LOG(...) if (nissy_log != NULL) write_wrapper(nissy_log, __VA_ARGS__);
4 21
5#ifdef DEBUG 22#ifdef DEBUG
6#define STATIC 23#define STATIC

Generated with cgit - Back to sebastiano.tronto.net