mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 12:21:34 +00:00
More logging
This commit is contained in:
parent
b2ed5fe479
commit
9d3ece8133
@ -21,6 +21,7 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#include "unix.h"
|
#include "unix.h"
|
||||||
|
#include "timer.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -129,29 +130,39 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
rowCount = (uint32) mysql_num_rows(res);
|
rowCount = (uint32) mysql_num_rows(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BenchTimer timer;
|
||||||
|
timer.reset();
|
||||||
|
|
||||||
MySQLRequestResult requestResult(
|
MySQLRequestResult requestResult(
|
||||||
res,
|
res,
|
||||||
(uint32) mysql_affected_rows(&mysql),
|
(uint32) mysql_affected_rows(&mysql),
|
||||||
rowCount,
|
rowCount,
|
||||||
(uint32) mysql_field_count(&mysql),
|
(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 (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
||||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||||
Log(Logs::General,
|
LogF(
|
||||||
|
Logs::General,
|
||||||
Logs::MySQLQuery,
|
Logs::MySQLQuery,
|
||||||
"%s (%u row%s returned)",
|
"{0} ({1} row{2} returned) ({3}ms)",
|
||||||
query,
|
query,
|
||||||
requestResult.RowCount(),
|
requestResult.RowCount(),
|
||||||
requestResult.RowCount() == 1 ? "" : "s");
|
requestResult.RowCount() == 1 ? "" : "s",
|
||||||
|
std::to_string(timer.elapsed())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log(Logs::General,
|
LogF(
|
||||||
|
Logs::General,
|
||||||
Logs::MySQLQuery,
|
Logs::MySQLQuery,
|
||||||
"%s (%u row%s affected)",
|
"{0} ({1} row{2} affected) ({3}ms)",
|
||||||
query,
|
query,
|
||||||
requestResult.RowsAffected(),
|
requestResult.RowsAffected(),
|
||||||
requestResult.RowsAffected() == 1 ? "" : "s");
|
requestResult.RowsAffected() == 1 ? "" : "s",
|
||||||
|
std::to_string(timer.elapsed())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -214,10 +214,6 @@ namespace Logs {
|
|||||||
OutF(LogSys, Logs::General, Logs::Debug, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::General, Logs::Debug, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Other
|
* Other
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -274,7 +274,7 @@ void Client::Handle_Login(const char *data, unsigned int size)
|
|||||||
* Login accepted
|
* Login accepted
|
||||||
*/
|
*/
|
||||||
if (result) {
|
if (result) {
|
||||||
LogDebug(
|
LogInfo(
|
||||||
"login [{0}] user [{1}] Login succeeded",
|
"login [{0}] user [{1}] Login succeeded",
|
||||||
db_loginserver,
|
db_loginserver,
|
||||||
user
|
user
|
||||||
@ -283,7 +283,7 @@ void Client::Handle_Login(const char *data, unsigned int size)
|
|||||||
DoSuccessfulLogin(user, db_account_id, db_loginserver);
|
DoSuccessfulLogin(user, db_account_id, db_loginserver);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogDebug(
|
LogInfo(
|
||||||
"login [{0}] user [{1}] Login failed",
|
"login [{0}] user [{1}] Login failed",
|
||||||
db_loginserver,
|
db_loginserver,
|
||||||
user
|
user
|
||||||
|
|||||||
@ -331,9 +331,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
|||||||
user_to_world_response->login
|
user_to_world_response->login
|
||||||
);
|
);
|
||||||
if (client) {
|
if (client) {
|
||||||
Log(Logs::General,
|
LogDebug("Found client with user id of {0} and account name of {1}",
|
||||||
Logs::Debug,
|
|
||||||
"Found client with user id of %u and account name of %s.",
|
|
||||||
user_to_world_response->lsaccountid,
|
user_to_world_response->lsaccountid,
|
||||||
client->GetAccountName().c_str()
|
client->GetAccountName().c_str()
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user