diff options
author | sanine <sanine.not@pm.me> | 2022-06-14 11:31:00 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-06-14 11:31:00 -0500 |
commit | d36b59bb1e501ec018faba3d9a60dbfb2b58114a (patch) | |
tree | 5f9021e2e4ec708df2409c03c7e01f091e63c274 /src/logging/logging.h | |
parent | 432bc96457244c18afe9473729dc52604ec03a9c (diff) |
add basic logging function
Diffstat (limited to 'src/logging/logging.h')
-rw-r--r-- | src/logging/logging.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/logging/logging.h b/src/logging/logging.h new file mode 100644 index 0000000..2618d2b --- /dev/null +++ b/src/logging/logging.h @@ -0,0 +1,22 @@ +#ifndef HONEY_LOGGING_H +#define HONEY_LOGGING_H + +#define HONEY_FATAL 0 +#define HONEY_ERROR 1 +#define HONEY_WARN 2 +#define HONEY_INFO 3 +#define HONEY_DEBUG 4 +#define HONEY_TRACE 5 + +extern int _honey_log_level; + +void honey_log(int level, const char *fmt, ...); + +#define honey_fatal(...) honey_log(HONEY_FATAL, "[FATAL] "__VA_ARGS__) +#define honey_error(...) honey_log(HONEY_ERROR, "[ERROR] "__VA_ARGS__) +#define honey_warn(...) honey_log(HONEY_WARN, "[WARN] " __VA_ARGS__) +#define honey_info(...) honey_log(HONEY_INFO, "[INFO] " __VA_ARGS__) +#define honey_debug(...) honey_log(HONEY_DEBUG, "[DEBUG] "__VA_ARGS__) +#define honey_trace(...) honey_log(HONEY_TRACE, "[TRACE] "__VA_ARGS__) + +#endif |