From e9aaba938b4f1b62b5f9018583a82ed7e7180977 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Mon, 14 Nov 2022 15:51:05 +0100 Subject: minor changes * fix typo * less code duplication * less `GString` usage * more `auto_gchar` usage * document connecting to servers supporting SASL ANONYMOUS * ignore valgrind output Signed-off-by: Steffen Jaeckel --- src/log.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/log.c') diff --git a/src/log.c b/src/log.c index 97c1a149..a1b7bb1d 100644 --- a/src/log.c +++ b/src/log.c @@ -233,21 +233,25 @@ log_msg(log_level_t level, const char* const area, const char* const msg) } } -log_level_t -log_level_from_string(char* log_level) +int +log_level_from_string(char* log_level, log_level_t* level) { + int ret = 0; assert(log_level != NULL); + assert(level != NULL); if (strcmp(log_level, "DEBUG") == 0) { - return PROF_LEVEL_DEBUG; + *level = PROF_LEVEL_DEBUG; } else if (strcmp(log_level, "INFO") == 0) { - return PROF_LEVEL_INFO; + *level = PROF_LEVEL_INFO; } else if (strcmp(log_level, "WARN") == 0) { - return PROF_LEVEL_WARN; + *level = PROF_LEVEL_WARN; } else if (strcmp(log_level, "ERROR") == 0) { - return PROF_LEVEL_ERROR; + *level = PROF_LEVEL_ERROR; } else { // default logging is warn - return PROF_LEVEL_WARN; + *level = PROF_LEVEL_WARN; + ret = -1; } + return ret; } const char* -- cgit 1.4.1-2-gfad0