Skip to content

Commit

Permalink
Properly disable logs on Release build
Browse files Browse the repository at this point in the history
  • Loading branch information
NicknineTheEagle committed Apr 30, 2024
1 parent b9da570 commit 5d81e07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void logging::SetupLogger() {
spdlog::set_level(spdlog::level::trace);
#else
// don't output logs if envvar is not defined
return;
spdlog::set_level(spdlog::level::off);
#endif
}
else spdlog::cfg::helpers::load_levels(envLogLevel);
Expand All @@ -40,6 +40,10 @@ void logging::SetupLogger() {
}

void logging::SetLoggerFileName(const std::string& fileName) {
/* Return early if logs are off, so files are not created */
if ( spdlog::get_level() == spdlog::level::off )
return;

try {
const auto logger = spdlog::basic_logger_mt("file",
fileName, true);
Expand Down

0 comments on commit 5d81e07

Please sign in to comment.