Convert MySQL Error logging to EQEmuLogSys and create MySQL Error category

This commit is contained in:
Akkadius 2015-01-19 05:58:03 -06:00
parent acb677a4ba
commit 99dc83a9fd
2 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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",
};
}