From 5dca0458a09ebc586fda49c50533976f055d8de2 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sat, 26 Jun 2021 22:15:09 +0100 Subject: log: add LOG_CLASS_NONE and use as initializer for log_level This means that logging will be completely disabled until log_init() has been called, which is useful to prevent log spam when running UNITTEST{} blocks in debug builds. Note that this doesn't change the default log level at runtime, which was already being set to LOG_CLASS_INFO in main.c and client.c. The new log level is also exposed to the command-line interface as `--log-level=none`, which allows disabling logging entirely. --- log.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'log.h') diff --git a/log.h b/log.h index 367fd60e..dc458199 100644 --- a/log.h +++ b/log.h @@ -5,7 +5,14 @@ enum log_colorize { LOG_COLORIZE_NEVER, LOG_COLORIZE_ALWAYS, LOG_COLORIZE_AUTO }; enum log_facility { LOG_FACILITY_USER, LOG_FACILITY_DAEMON }; -enum log_class { LOG_CLASS_ERROR, LOG_CLASS_WARNING, LOG_CLASS_INFO, LOG_CLASS_DEBUG }; + +enum log_class { + LOG_CLASS_NONE, + LOG_CLASS_ERROR, + LOG_CLASS_WARNING, + LOG_CLASS_INFO, + LOG_CLASS_DEBUG +}; void log_init(enum log_colorize colorize, bool do_syslog, enum log_facility syslog_facility, enum log_class log_level); -- cgit v1.3