From 01f655a0f89d9628689f02e6c1efe3a32918c2ef Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Fri, 13 Dec 2024 08:31:07 +0100 Subject: [PATCH] Fix setting log level by string Just comparing a single character is not a good idea: 'do not log anything please' would enable debug output ... Skipping uppercase conversion as we always emit an error if the provided level name cannot be identified. Signed-off-by: Christoph Niethammer --- src/utils/Logger.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/Logger.h b/src/utils/Logger.h index d8215a0af..30df11e84 100644 --- a/src/utils/Logger.h +++ b/src/utils/Logger.h @@ -189,10 +189,8 @@ class Logger { } /// set log level from string logLevel set_log_level(std::string l) { - // identify the loglevel by comparing the first char of the names for (const auto& [lvl, name] : logLevelNames) { - // case-insensitive matching - if (std::toupper(name[0]) == std::toupper(l[0])) { + if (name == l) { _log_level = lvl; return _log_level; }