Skip to content

Commit

Permalink
fix(Common/Logging): correct check existring logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Winfidonarleyan committed Dec 16, 2023
1 parent a50c225 commit 4639856
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/Logging/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ void Warhead::Log::CreateLoggerFromConfig(std::string_view configLoggerName)
if (configLoggerName.empty())
return;

if (GetLogger(configLoggerName))
std::string const& options = sConfigMgr->GetOption<std::string>(std::string{ configLoggerName }, "");
auto loggerName = configLoggerName.substr(PREFIX_LOGGER_LENGTH);

if (GetLogger(loggerName))
{
spdlog::error("Log::CreateLoggerFromConfig: {} is exist\n", configLoggerName);
return;
}

std::string const& options = sConfigMgr->GetOption<std::string>(std::string{ configLoggerName }, "");
auto loggerName = configLoggerName.substr(PREFIX_LOGGER_LENGTH);

if (options.empty())
{
spdlog::error("Log::CreateLoggerFromConfig: Missing config option Logger.{}\n", loggerName);
Expand Down Expand Up @@ -384,4 +384,4 @@ void Warhead::Log::Write(std::string_view filter, spdlog::source_loc source, spd
void Warhead::Log::WriteCommand(uint32 /*accountID*/, std::string_view message)
{
Write("commands.gm", {}, spdlog::level::info, message);
}
}

0 comments on commit 4639856

Please sign in to comment.