Core/Logging: Minor compile time reducing refactor of log message formatting

This commit is contained in:
Shauren
2023-07-23 00:27:26 +02:00
parent 3be66cee26
commit 576ca241ec
6 changed files with 51 additions and 17 deletions

View File

@@ -221,17 +221,17 @@ void Log::RegisterAppender(uint8 index, AppenderCreatorFn appenderCreateFn)
appenderFactory[index] = appenderCreateFn;
}
void Log::OutMessageImpl(std::string_view filter, LogLevel level, std::string&& message)
void Log::OutMessageImpl(std::string_view filter, LogLevel level, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs)
{
write(std::make_unique<LogMessage>(level, std::string(filter), std::move(message)));
write(std::make_unique<LogMessage>(level, filter, Trinity::StringVFormat(messageFormat, messageFormatArgs)));
}
void Log::OutCommandImpl(std::string&& message, std::string&& param1)
void Log::OutCommandImpl(uint32 account, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs)
{
write(std::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", std::move(message), std::move(param1)));
write(std::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", Trinity::StringVFormat(messageFormat, messageFormatArgs), Trinity::ToString(account)));
}
void Log::write(std::unique_ptr<LogMessage>&& msg) const
void Log::write(std::unique_ptr<LogMessage> msg) const
{
Logger const* logger = GetLoggerByType(msg->type);