Skip to content

Commit

Permalink
Merge pull request #379 from ls1mardyn/fixLoggerComparison
Browse files Browse the repository at this point in the history
Fix Logger output by using case-insensitive comparison
  • Loading branch information
HomesGH authored Feb 5, 2025
2 parents e48af35 + 5bdfce5 commit 6a1a240
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#define USE_GETTIMEOFDAY

#include <algorithm>
#include <chrono>
#include <ctime>
#include <cctype>
Expand Down Expand Up @@ -189,8 +190,11 @@ class Logger {
}
/// set log level from string
logLevel set_log_level(std::string l) {
// Compare case-insensitive
std::string l_upper = l;
std::transform(l_upper.begin(), l_upper.end(), l_upper.begin(), [](unsigned char c){ return std::toupper(c);});
for (const auto& [lvl, name] : logLevelNames) {
if (name == l) {
if (name == l_upper) {
_log_level = lvl;
return _log_level;
}
Expand Down

0 comments on commit 6a1a240

Please sign in to comment.