From 99dc83a9fd22affaab378dde2194585a75049ee4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:58:03 -0600 Subject: [PATCH] Convert MySQL Error logging to EQEmuLogSys and create MySQL Error category --- common/dbcore.cpp | 7 ++----- common/eqemu_logsys.h | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 7570fd01e..d1ae89d32 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -3,6 +3,7 @@ #endif #include "../common/misc_functions.h" +#include "../common/eqemu_logsys.h" #include "dbcore.h" @@ -115,11 +116,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo /* Implement Logging at the Root */ if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ - std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl; - /* Write to log file */ - std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); - log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n"; - log.close(); + Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query); } return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 26a80392f..737c42f38 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,6 +74,7 @@ namespace Logs{ WebInterface_Server, World_Server, Zone_Server, + MySQLError, MaxCategoryID /* Don't Remove this*/ }; @@ -114,6 +115,7 @@ namespace Logs{ "WebInterface Server", "World Server", "Zone Server", + "MySQL Error", }; }