Updated the logging system

This commit is contained in:
WolverinDEV
2019-11-23 21:16:55 +01:00
parent b7d60361c0
commit fb5dc72970
28 changed files with 135 additions and 104 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ void QueryClient::writeMessage(const std::string& message) {
if(this->connectionType == ConnectionType::PLAIN) this->writeRawMessage(message);
else if(this->connectionType == ConnectionType::SSL_ENCRIPTED) this->ssl_handler.send(pipes::buffer_view{(void*) message.data(), message.length()});
else logCritical("Invalid query connection type!");
else logCritical(LOG_GENERAL, "Invalid query connection type to write to!");
}
@@ -135,7 +135,7 @@ CommandResult QueryClient::handleCommandLogin(Command& cmd) {
username = cmd[0][0].key();
password = cmd[0][1].key();
}
debugMessage("Attempted query login with " + username + " - " + password);
debugMessage(LOG_QUERY, "Having query login attempt for username {}", username);
auto _account = serverInstance->getQueryServer()->find_query_account_by_name(username);
auto account = _account ? serverInstance->getQueryServer()->load_password(_account) : nullptr;
@@ -374,7 +374,6 @@ CommandResult QueryClient::handleCommandJoin(Command &) {
if(this->currentChannel)
return {findError("server_already_joined"), "already joined!"};
debugMessage("Uid -> " + this->properties()[property::CLIENT_UNIQUE_IDENTIFIER].as<string>());
this->server->assignDefaultChannel(this->ref(), true);
return CommandResult::Success;
}
@@ -811,7 +810,7 @@ CommandResult QueryClient::handleCommandServerSnapshotDeploy(Command& cmd) {
auto hash = cmd["hash"].string();
if(hash.empty()) return {findError("parameter_invalid"), "Invalid hash (not present)"};
debugMessage("Hash: '" + hash + "'");
debugMessage(this->getServerId(), "Serversnapshot calculated hash: {}", hash);
bool mapping = cmd.hasParm("mapping");
cmd.disableParm("mapping");
@@ -834,7 +833,7 @@ CommandResult QueryClient::handleCommandServerSnapshotDeploy(Command& cmd) {
Command res("");
if(!result){
logError("Could not apply server snapshot: " + error);
logError(this->getServerId(), "Could not apply server snapshot: {}", error);
res["success"] = false;
res["sid"] = 0;
res["message"] = error;
@@ -929,7 +928,7 @@ CommandResult QueryClient::handleCommandServerNotifyRegister(Command &cmd) {
CMD_REQ_PARM("event");
CMD_RESET_IDLE;
if(!cmd[0].has("specifier") && cmd["event"].as<string>() != "all") { //Lagacy support
logMessage("[Query] Client " + this->getLoggingPeerIp() + ":" + to_string(this->getPeerPort()) + " uses the lagacy notify system, which is deprecated!");
logMessage(this->getServerId(), "{} Client {}:{} uses the lagacy notify system, which is deprecated!", CLIENT_STR_LOG_PREFIX, this->getLoggingPeerIp(), this->getPeerPort());
string event = cmd["event"];
std::transform(event.begin(), event.end(), event.begin(), ::tolower);
#include "XMacroEventTypes.h"
@@ -985,7 +984,7 @@ CommandResult QueryClient::handleCommandServerNotifyUnregister(Command &cmd) {
CMD_REQ_PARM("event");
CMD_RESET_IDLE;
if(!cmd[0].has("specifier")){
logMessage("[Query] Client " + this->getLoggingPeerIp() + ":" + to_string(this->getPeerPort()) + " uses the lagacy notify system, which is deprecated!");
logMessage(this->getServerId(), "{} Client {}:{} uses the lagacy notify system, which is deprecated!", CLIENT_STR_LOG_PREFIX, this->getLoggingPeerIp(), this->getPeerPort());
string event = cmd["event"];
std::transform(event.begin(), event.end(), event.begin(), ::tolower);
#include "XMacroEventTypes.h"