Skip to content

Commit

Permalink
log: add a new log level, verbose
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Dec 18, 2023
1 parent 7366553 commit aed2a20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@

enum log_level {
LOG_LEVEL_INVALID = -1,
/// Very noisy debug messages, many lines per frame.
LOG_LEVEL_TRACE = 0,
/// Frequent debug messages, a few lines per frame.
LOG_LEVEL_VERBOSE,
/// Less frequent debug messages.
LOG_LEVEL_DEBUG,
/// Informational messages.
LOG_LEVEL_INFO,
/// Warnings.
LOG_LEVEL_WARN,
/// Errors.
LOG_LEVEL_ERROR,
/// Fatal errors.
LOG_LEVEL_FATAL,
};

Expand All @@ -31,6 +39,7 @@ enum log_level {
} \
} while (0)
#define log_trace(x, ...) LOG_UNLIKELY(TRACE, x, ##__VA_ARGS__)
#define log_verbose(x, ...) LOG_UNLIKELY(VERBOSE, x, ##__VA_ARGS__)
#define log_debug(x, ...) LOG_UNLIKELY(DEBUG, x, ##__VA_ARGS__)
#define log_info(x, ...) LOG(INFO, x, ##__VA_ARGS__)
#define log_warn(x, ...) LOG(WARN, x, ##__VA_ARGS__)
Expand Down

0 comments on commit aed2a20

Please sign in to comment.