logging: refactor enabling of debug messages

Reorder the LOGS_Severity enum in order of severity and change the code
to not log/print messages with severity below the specified minimum
instead of having a separate debug level.
This commit is contained in:
Miroslav Lichvar
2019-07-02 16:18:06 +02:00
parent d30e73d0d9
commit 1227873b88
4 changed files with 22 additions and 29 deletions

View File

@@ -77,7 +77,7 @@ static int csv_mode = 0;
/* Log a message. This is a minimalistic replacement of the logging.c
implementation to avoid linking with it and other modules. */
int log_debug_enabled = 0;
LOG_Severity log_min_severity = LOGS_INFO;
void LOG_Message(LOG_Severity severity,
#if DEBUG > 0
@@ -3222,7 +3222,7 @@ main(int argc, char **argv)
csv_mode = 1;
break;
case 'd':
log_debug_enabled = 1;
log_min_severity = LOGS_DEBUG;
break;
case 'h':
hostnames = optarg;