diff options
Diffstat (limited to 'src/utils/dbg_log.h')
| -rw-r--r-- | src/utils/dbg_log.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h new file mode 100644 index 0000000..427eceb --- /dev/null +++ b/src/utils/dbg_log.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | void (*nissy_log)(const char *, ...); | ||
| 2 | |||
| 3 | #define LOG(...) if (nissy_log != NULL) nissy_log(__VA_ARGS__); | ||
| 4 | |||
| 5 | #ifdef DEBUG | ||
| 6 | #define _static | ||
| 7 | #define _static_inline | ||
| 8 | #define DBG_WARN(condition, ...) if (!(condition)) LOG(__VA_ARGS__); | ||
| 9 | #define DBG_ASSERT(condition, retval, ...) \ | ||
| 10 | if (!(condition)) { LOG(__VA_ARGS__); return retval; } | ||
| 11 | #else | ||
| 12 | #define _static static | ||
| 13 | #define _static_inline static inline | ||
| 14 | #define DBG_WARN(condition, ...) | ||
| 15 | #define DBG_ASSERT(condition, retval, ...) | ||
| 16 | #endif | ||
