chore(Core/Logging): replace most server loggers (#5726)

* chore(Core/Logging): replace most server loggers

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Kargatum
2021-06-21 08:07:12 +07:00
committed by GitHub
parent 9f80a592bb
commit 5787d00d54
199 changed files with 2312 additions and 4487 deletions

View File

@@ -240,7 +240,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
LOG_ERROR("server", "WorldSocket::SendPacket enqueue_tail failed");
LOG_ERROR("network", "WorldSocket::SendPacket enqueue_tail failed");
mb->release();
return -1;
}
@@ -283,7 +283,7 @@ int WorldSocket::open(void* a)
if (peer().get_remote_addr(remote_addr) == -1)
{
LOG_ERROR("server", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
LOG_ERROR("network", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -301,7 +301,7 @@ int WorldSocket::open(void* a)
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
LOG_ERROR("server", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
LOG_ERROR("network", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -337,18 +337,14 @@ int WorldSocket::handle_input(ACE_HANDLE)
return Update(); // interesting line, isn't it ?
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
#endif
LOG_DEBUG("network", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
errno = ECONNRESET;
return -1;
}
case 0:
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "WorldSocket::handle_input: Peer has closed connection");
#endif
LOG_DEBUG("network", "WorldSocket::handle_input: Peer has closed connection");
errno = ECONNRESET;
return -1;
@@ -417,7 +413,7 @@ int WorldSocket::handle_output_queue()
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
LOG_ERROR("server", "WorldSocket::handle_output_queue dequeue_head");
LOG_ERROR("network", "WorldSocket::handle_output_queue dequeue_head");
return -1;
}
@@ -452,7 +448,7 @@ int WorldSocket::handle_output_queue()
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{
LOG_ERROR("server", "WorldSocket::handle_output_queue enqueue_head");
LOG_ERROR("network", "WorldSocket::handle_output_queue enqueue_head");
mblk->release();
return -1;
}
@@ -530,7 +526,7 @@ int WorldSocket::handle_input_header(void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
LOG_ERROR("server", "WorldSocket::handle_input_header(): client (%s) sent malformed packet (size: %hd, cmd: %d)",
LOG_ERROR("network", "WorldSocket::handle_input_header(): client (%s) sent malformed packet (size: %hd, cmd: %d)",
GetRemoteAddress().c_str(), header.size, header.cmd);
errno = EINVAL;
@@ -633,7 +629,7 @@ int WorldSocket::handle_input_missing_data(void)
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
LOG_ERROR("server", "Forcing close on input m_RecvWPct = nullptr");
LOG_ERROR("network", "Forcing close on input m_RecvWPct = nullptr");
errno = EINVAL;
return -1;
}
@@ -677,7 +673,7 @@ int WorldSocket::cancel_wakeup_output()
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
LOG_ERROR("server", "WorldSocket::cancel_wakeup_output");
LOG_ERROR("network", "WorldSocket::cancel_wakeup_output");
return -1;
}
@@ -694,7 +690,7 @@ int WorldSocket::schedule_wakeup_output()
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
LOG_ERROR("server", "WorldSocket::schedule_wakeup_output");
LOG_ERROR("network", "WorldSocket::schedule_wakeup_output");
return -1;
}
@@ -727,12 +723,12 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return HandlePing(*new_pct);
}
catch (ByteBufferPositionException const&) { }
LOG_ERROR("server", "WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING");
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING");
return -1;
case CMSG_AUTH_SESSION:
if (m_Session)
{
LOG_ERROR("server", "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
LOG_ERROR("network", "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
return -1;
}
return HandleAuthSession (*new_pct);
@@ -749,7 +745,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
}
catch (ByteBufferException const&)
{
LOG_ERROR("server", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%u. Disconnected client.",
LOG_ERROR("network", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%u. Disconnected client.",
aptr->GetOpcode(), GetRemoteAddress().c_str(), m_Session ? m_Session->GetAccountId() : 0);
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
@@ -785,7 +781,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return 0;
}
LOG_ERROR("server", "WorldSocket::ProcessIncoming: Client not authed opcode = %u", aptr->GetOpcode());
LOG_ERROR("network", "WorldSocket::ProcessIncoming: Client not authed opcode = %u", aptr->GetOpcode());
return -1;
}
@@ -806,7 +802,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
packet << uint8(AUTH_REJECT);
SendPacket(packet);
LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
@@ -822,10 +818,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
recvPacket >> DosResponse;
recvPacket.read(digest);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "WorldSocket::HandleAuthSession: client %u, loginServerID %u, accountName %s, loginServerType %u",
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: client %u, loginServerID %u, accountName %s, loginServerType %u",
BuiltNumberClient, loginServerID, accountName.c_str(), loginServerType);
#endif
// Get the account information from the realmd database
// 0 1 2 3 4 5 6 7 8 9 10
// SELECT id, sessionkey, last_ip, locked, lock_country, expansion, mutetime, locale, recruiter, os, totaltime FROM account WHERE username = ?
@@ -844,7 +839,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
SendPacket(packet);
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
@@ -870,7 +865,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
packet << uint8(AUTH_REJECT);
SendPacket(packet);
LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str());
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str());
sScriptMgr->OnFailedAccountLogin(account.Id);
return -1;
}
@@ -914,10 +909,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
packet << uint8(AUTH_FAILED);
SendPacket(packet);
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Id, accountName.c_str(), address.c_str());
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Id, accountName.c_str(), address.c_str());
return -1;
}
@@ -1042,7 +1035,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
{
Player* _player = m_Session->GetPlayer();
LOG_ERROR("server", "WorldSocket::HandlePing: Player (account: %u, %s, name: %s) kicked for over-speed pings (address: %s)",
LOG_ERROR("network", "WorldSocket::HandlePing: Player (account: %u, %s, name: %s) kicked for over-speed pings (address: %s)",
m_Session->GetAccountId(),
_player ? _player->GetGUID().ToString().c_str() : "",
_player ? _player->GetName().c_str() : "<none>",
@@ -1066,7 +1059,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
}
else
{
LOG_ERROR("server", "WorldSocket::HandlePing: peer sent CMSG_PING, "
LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());