Core/Logging: Partial cherry-pick from commit c6ab951025b0be3b0f6
* solves differences 3.3.5 <-> 6.x because of make_unique workarround. (cherry picked from commit c6ab951025b0be3b0f64dc8bb0703d4aa8bdb003) Signed-off-by: Naios <naios-dev@live.de>
This commit is contained in:
1 parent
09d34e0a9b
commit
b0255927f0
2 files changed
+14
-2
No files matched your search
@@ -38,6 +38,7 @@
|
||||
#include <queue>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "Debugging/Errors.h"
|
||||
|
||||
@@ -144,4 +145,14 @@ typedef std::vector<std::string> StringVector;
|
||||
|
||||
#define MAX_QUERY_LEN 32*1024
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
//! std::make_unique implementation (TODO: remove this once C++14 is supported)
|
||||
template<typename T, typename ...Args>
|
||||
std::unique_ptr<T> make_unique(Args&& ...args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Appender.h"
|
||||
#include "Logger.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Common.h"
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/strand.hpp>
|
||||
|
||||
@@ -64,7 +65,7 @@ class Log
|
||||
template<typename... Args>
|
||||
inline void outMessage(std::string const& filter, LogLevel const level, const char* fmt, Args const&... args)
|
||||
{
|
||||
write(std::unique_ptr<LogMessage>(new LogMessage(level, filter, Trinity::StringFormat(fmt, args...))));
|
||||
write(Trinity::make_unique<LogMessage>(level, filter, Trinity::StringFormat(fmt, args...)));
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -73,7 +74,7 @@ class Log
|
||||
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
|
||||
return;
|
||||
|
||||
std::unique_ptr<LogMessage> msg(new 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", std::move(Trinity::StringFormat(fmt, args...)));
|
||||
|
||||
msg->param1 = std::to_string(account);
|
||||
|
||||
|
||||
Reference in new issue
Block a user