feat(Core/Logging): rework logging (#4692)

* feat(Core/Logging): rework logging

* correct level for sql.sql

* del unused config options

* Correct build

* correct after merge

* whitespace

20:29:37 1. 'Player.cpp'. Replace (1)
20:29:37 2. 'ObjectMgr.cpp'. Replace (3)

* 1

* correct logging

* correct affter merge

* 1

* 2

* LOG_LEVEL_WARN

* #include "AppenderDB.h"

* 3

* 4

* 5

* 1. 'WorldSocket.cpp'. Replace (1)

* 6

* 1
This commit is contained in:
Kargatum
2021-04-17 16:20:07 +07:00
committed by GitHub
parent b2861be1cd
commit 4af4cbd3d9
246 changed files with 7413 additions and 6807 deletions

View File

@@ -33,18 +33,18 @@ int RASocket::open(void*)
if (peer().get_remote_addr(remoteAddress) == -1)
{
sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
LOG_ERROR("server", "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
return -1;
}
sLog->outRemote("Incoming connection from %s", remoteAddress.get_host_addr());
LOG_INFO("network", "Incoming connection from %s", remoteAddress.get_host_addr());
return activate();
}
int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/)
{
sLog->outRemote("Closing connection");
LOG_INFO("network", "Closing connection");
peer().close_reader();
wait();
// While the above wait() will wait for the ::svc() to finish, it will not wait for the async event
@@ -120,7 +120,7 @@ int RASocket::recv_line(std::string& out_line)
if (recv_line(message_block) == -1)
{
sLog->outRemote("Recv error %s", ACE_OS::strerror(errno));
LOG_INFO("network", "Recv error %s", ACE_OS::strerror(errno));
return -1;
}
@@ -134,7 +134,7 @@ int RASocket::process_command(const std::string& command)
if (command.length() == 0)
return 0;
sLog->outRemote("Got command: %s", command.c_str());
LOG_INFO("network", "Got command: %s", command.c_str());
// handle quit, exit and logout commands to terminate connection
if (command == "quit" || command == "exit" || command == "logout")
@@ -184,7 +184,7 @@ int RASocket::check_access_level(const std::string& user)
if (!result)
{
sLog->outRemote("User %s does not exist in database", user.c_str());
LOG_INFO("network", "User %s does not exist in database", user.c_str());
return -1;
}
@@ -192,12 +192,12 @@ int RASocket::check_access_level(const std::string& user)
if (fields[1].GetUInt8() < _minLevel)
{
sLog->outRemote("User %s has no privilege to login", user.c_str());
LOG_INFO("network", "User %s has no privilege to login", user.c_str());
return -1;
}
else if (fields[2].GetInt32() != -1)
{
sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
LOG_INFO("network", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
return -1;
}
@@ -225,7 +225,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
return 0;
}
sLog->outRemote("Wrong password for user: %s", user.c_str());
LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str());
return -1;
}
@@ -245,7 +245,7 @@ int RASocket::authenticate()
if (recv_line(pass) == -1)
return -1;
sLog->outRemote("Login attempt for user: %s", user.c_str());
LOG_INFO("network", "Login attempt for user: %s", user.c_str());
if (check_access_level(user) == -1)
return -1;
@@ -253,7 +253,7 @@ int RASocket::authenticate()
if (check_password(user, pass) == -1)
return -1;
sLog->outRemote("User login: %s", user.c_str());
LOG_INFO("network", "User login: %s", user.c_str());
return 0;
}
@@ -286,7 +286,7 @@ int RASocket::subnegotiate()
if (n >= 1024)
{
sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
LOG_INFO("network", "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
return -1;
}
@@ -320,7 +320,7 @@ int RASocket::subnegotiate()
uint8 param = buf[++i];
ss << uint32(param);
sLog->outRemote(ss.str().c_str());
LOG_INFO("network", ss.str().c_str());
}
++i;
}
@@ -386,7 +386,7 @@ void RASocket::zprint(void* callbackArg, const char* szText)
ACE_Time_Value tv = ACE_Time_Value::zero;
if (socket->putq(mb, &tv) == -1)
{
sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
LOG_INFO("network", "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
@@ -407,7 +407,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/)
if (socket->putq(mb->duplicate()) == -1)
{
// getting here is bad, command can't be marked as complete
//sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
//LOG_DEBUG("misc", "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
}
mb->release();