From 1fb45c44ac910ced8912790e569c0336305a963f Mon Sep 17 00:00:00 2001 From: Yehonal Date: Tue, 30 Aug 2016 22:27:54 +0200 Subject: [PATCH] Restored db logging function --- modules/worldengine/nucleus/src/Logging/Log.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/worldengine/nucleus/src/Logging/Log.cpp b/modules/worldengine/nucleus/src/Logging/Log.cpp index 1d8067f49..41d41b5dc 100644 --- a/modules/worldengine/nucleus/src/Logging/Log.cpp +++ b/modules/worldengine/nucleus/src/Logging/Log.cpp @@ -342,12 +342,14 @@ std::string Log::GetTimestampStr() void Log::outDB(LogTypes type, const char * str) { - if (!str || type >= MAX_LOG_TYPES) - return; - - std::string logStr(str); - if (logStr.empty()) + if(!str || std::string(str).empty() || type >= MAX_LOG_TYPES) return; + + std::string new_str(str); + LoginDatabase.EscapeString(new_str); + + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) " + "VALUES (" UI64FMTD ", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str()); } void Log::outString(const char * str, ...)