aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Logging/Log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Logging/Log.h')
-rw-r--r--src/server/shared/Logging/Log.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 5b3782fce55..ab7b2169ed2 100644
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -62,19 +62,22 @@ class Log
bool ShouldLog(std::string const& type, LogLevel level) const;
bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
- template<typename... Args>
- inline void outMessage(std::string const& filter, LogLevel const level, const char* fmt, Args const&... args)
+ template<typename Format, typename... Args>
+ inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args)
{
- write(Trinity::make_unique<LogMessage>(level, filter, Trinity::StringFormat(fmt, args...)));
+ write(Trinity::make_unique<LogMessage>(level, filter,
+ Trinity::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)));
}
- template<typename... Args>
- void outCommand(uint32 account, const char* fmt, Args const&... args)
+ template<typename Format, typename... Args>
+ void outCommand(uint32 account, Format&& fmt, Args&&... args)
{
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
return;
- std::unique_ptr<LogMessage> msg = Trinity::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", std::move(Trinity::StringFormat(fmt, args...)));
+ std::unique_ptr<LogMessage> msg =
+ Trinity::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm",
+ Trinity::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
msg->param1 = std::to_string(account);
@@ -160,7 +163,8 @@ inline bool Log::ShouldLog(std::string const& type, LogLevel level) const
}
#if PLATFORM != PLATFORM_WINDOWS
-void check_args(const char* format, ...) ATTR_PRINTF(1, 2);
+void check_args(const char*, ...) ATTR_PRINTF(1, 2);
+void check_args(std::string const&, ...);
// This will catch format errors on build time
#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \