diff options
author | Naios <naios-dev@live.de> | 2015-07-21 23:17:00 +0200 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2015-07-22 00:32:28 +0200 |
commit | 026ceb85b9e0e870d95cea42895e867198c156dd (patch) | |
tree | a660500f2c575da3ff9a3b61674d2db03ed5bfea /src/server/shared/Logging/Log.cpp | |
parent | 033fc20985f17caff24a9757fe6219ce50139360 (diff) |
Core/Logging: Enable perfect forwarding for logging format and args.
* Handle timestamp parsing though cppformat.
* Change a wrong forward -> move
Diffstat (limited to 'src/server/shared/Logging/Log.cpp')
-rw-r--r-- | src/server/shared/Logging/Log.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index c9a4432039f..f9f96c3da75 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -270,7 +270,7 @@ void Log::write(std::unique_ptr<LogMessage>&& msg) const if (_ioService) { - auto logOperation = std::shared_ptr<LogOperation>(new LogOperation(logger, std::forward<std::unique_ptr<LogMessage>>(msg))); + auto logOperation = std::shared_ptr<LogOperation>(new LogOperation(logger, std::move(msg))); _ioService->post(_strand->wrap([logOperation](){ logOperation->call(); })); } @@ -291,9 +291,8 @@ std::string Log::GetTimestampStr() // HH hour (2 digits 00-23) // MM minutes (2 digits 00-59) // SS seconds (2 digits 00-59) - char buf[20]; - snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); - return std::string(buf); + return Trinity::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d", + aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); } bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */) |