diff options
Diffstat (limited to 'src/logging/logging.h')
-rw-r--r-- | src/logging/logging.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/logging/logging.h b/src/logging/logging.h index 4357ae1..8f4d174 100644 --- a/src/logging/logging.h +++ b/src/logging/logging.h @@ -5,7 +5,7 @@ struct honey_log_info { - enum { DEBUG, INFO, WARN, ERROR, FATAL } log_level; + enum { FATAL, ERROR, WARN, INFO, DEBUG } log_level; FILE *debug_out; FILE *info_out; FILE *warn_out; @@ -15,8 +15,14 @@ struct honey_log_info { const char * honey_log_level_str_(struct honey_log_info *info); -#define honey_debug_(info, ...) \ - fprintf(info.debug_out, "[DEBUG] " __VA_ARGS__) +#define honey_log_(info, required_level, prefix, ...) do { \ + if (info.log_level >= required_level) { \ + fprintf(info.debug_out, prefix " " __VA_ARGS__); \ + } \ + } while(0) + +#define honey_debug_(info, ...) \ + honey_log_(info, DEBUG, "[DEBUG]", __VA_ARGS__) #endif |