More logging

This commit is contained in:
Akkadius 2019-07-05 18:34:08 -05:00
parent b2ed5fe479
commit 9d3ece8133
4 changed files with 21 additions and 16 deletions

View File

@ -21,6 +21,7 @@
#else
#include "unix.h"
#include "timer.h"
#include <pthread.h>
#endif
@ -129,29 +130,39 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
rowCount = (uint32) mysql_num_rows(res);
}
BenchTimer timer;
timer.reset();
MySQLRequestResult requestResult(
res,
(uint32) mysql_affected_rows(&mysql),
rowCount,
(uint32) mysql_field_count(&mysql),
(uint32) mysql_insert_id(&mysql));
(uint32) mysql_insert_id(&mysql)
);
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
if ((strncasecmp(query, "select", 6) == 0)) {
Log(Logs::General,
LogF(
Logs::General,
Logs::MySQLQuery,
"%s (%u row%s returned)",
"{0} ({1} row{2} returned) ({3}ms)",
query,
requestResult.RowCount(),
requestResult.RowCount() == 1 ? "" : "s");
requestResult.RowCount() == 1 ? "" : "s",
std::to_string(timer.elapsed())
);
}
else {
Log(Logs::General,
LogF(
Logs::General,
Logs::MySQLQuery,
"%s (%u row%s affected)",
"{0} ({1} row{2} affected) ({3}ms)",
query,
requestResult.RowsAffected(),
requestResult.RowsAffected() == 1 ? "" : "s");
requestResult.RowsAffected() == 1 ? "" : "s",
std::to_string(timer.elapsed())
);
}
}

View File

@ -214,10 +214,6 @@ namespace Logs {
OutF(LogSys, Logs::General, Logs::Debug, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
/**
* Other
*/

View File

@ -274,7 +274,7 @@ void Client::Handle_Login(const char *data, unsigned int size)
* Login accepted
*/
if (result) {
LogDebug(
LogInfo(
"login [{0}] user [{1}] Login succeeded",
db_loginserver,
user
@ -283,7 +283,7 @@ void Client::Handle_Login(const char *data, unsigned int size)
DoSuccessfulLogin(user, db_account_id, db_loginserver);
}
else {
LogDebug(
LogInfo(
"login [{0}] user [{1}] Login failed",
db_loginserver,
user

View File

@ -331,9 +331,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
user_to_world_response->login
);
if (client) {
Log(Logs::General,
Logs::Debug,
"Found client with user id of %u and account name of %s.",
LogDebug("Found client with user id of {0} and account name of {1}",
user_to_world_response->lsaccountid,
client->GetAccountName().c_str()
);