Skip to content

Commit

Permalink
Set log level prior to logging Log config info (#286)
Browse files Browse the repository at this point in the history
Co-authored-by: Josef <josef.holmner@algoryx.com>
  • Loading branch information
AlgoryxJosef and AlgoryxJosef authored May 28, 2024
1 parent f3ab7c8 commit 80facf3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ void Logger::configure(rgl_log_level_t logLevel, std::optional<std::filesystem::
}

mainLogger = std::make_shared<spdlog::logger>("RGL", sinkList.begin(), sinkList.end());
mainLogger->set_level(spdlog::level::info); // Print logging configuration as INFO
mainLogger->set_level(static_cast<spdlog::level::level_enum>(logLevel));
mainLogger->set_pattern("[%c]: %v");
mainLogger->info("Logging configured: level={}, file={}, stdout={}",
spdlog::level::to_string_view(static_cast<spdlog::level::level_enum>(logLevel)),
logFilePath.has_value() ? logFilePath.value().string() : "(disabled)", useStdout);
// https://spdlog.docsforge.com/master/3.custom-formatting/#pattern-flags
mainLogger->set_pattern("[%T][%6i us][%l]: %v");
mainLogger->set_level(static_cast<spdlog::level::level_enum>(logLevel));
}

0 comments on commit 80facf3

Please sign in to comment.