Skip to content

Commit

Permalink
Fix setting log level by string
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cniethammer committed Dec 13, 2024
1 parent 1f2fb23 commit 01f655a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/utils/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 01f655a

Please sign in to comment.