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

@@ -25,9 +25,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
uint32 guildId;
recvPacket >> guildId;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId);
#endif
if (!guildId)
return;
@@ -40,7 +38,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
std::string name;
recvPacket >> name;
LOG_ERROR("server", "CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str());
LOG_ERROR("network.opcode", "CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str());
}
void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
@@ -48,9 +46,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
std::string invitedName;
recvPacket >> invitedName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str());
#endif
if (normalizePlayerName(invitedName))
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleInviteMember(this, invitedName);
@@ -61,9 +57,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
std::string playerName;
recvPacket >> playerName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
#endif
if (normalizePlayerName(playerName))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -72,9 +66,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str());
#endif
if (!GetPlayer()->GetGuildId())
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited()))
@@ -83,9 +75,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str());
#endif
GetPlayer()->SetGuildIdInvited(0);
GetPlayer()->SetInGuild(0);
@@ -93,9 +83,7 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendInfo(this);
@@ -103,9 +91,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRoster(this);
@@ -118,9 +104,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
std::string playerName;
recvPacket >> playerName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
#endif
if (normalizePlayerName(playerName))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -132,9 +116,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
std::string playerName;
recvPacket >> playerName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
#endif
if (normalizePlayerName(playerName))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -143,9 +125,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleLeaveMember(this);
@@ -153,9 +133,7 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleDisband(this);
@@ -166,9 +144,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
std::string name;
recvPacket >> name;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str());
#endif
if (normalizePlayerName(name))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -180,9 +156,7 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
std::string motd;
recvPacket >> motd;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str());
#endif
// Check for overflow
if (motd.length() > 128)
@@ -201,9 +175,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
std::string note;
recvPacket >> playerName >> note;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
#endif
// Check for overflow
if (note.length() > 31)
@@ -223,10 +195,8 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
std::string note;
recvPacket >> playerName >> note;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s",
GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
#endif
// Check for overflow
if (note.length() > 31)
@@ -254,9 +224,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
uint32 money;
recvPacket >> money;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId);
#endif
Guild* guild = GetPlayer()->GetGuild();
if (!guild)
@@ -293,9 +261,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
std::string rankName;
recvPacket >> rankName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str());
#endif
// Check for overflow
if (rankName.length() > 15)
@@ -310,9 +276,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRemoveLowestRank(this);
@@ -323,9 +287,7 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
std::string info;
recvPacket >> info;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str());
#endif
// Check for overflow
if (info.length() > 500)
@@ -346,12 +308,10 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
EmblemInfo emblemInfo;
emblemInfo.ReadPacket(recvPacket);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [%s] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
, GetPlayerInfo().c_str(), vendorGuid.ToString().c_str(), emblemInfo.GetStyle()
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
#endif
if (GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER))
{
// Remove fake death
@@ -369,9 +329,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendEventLog(this);
@@ -379,9 +337,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recvData */)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendMoneyInfo(this);
@@ -389,9 +345,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recvData */)
void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str());
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendPermissions(this);
@@ -404,10 +358,8 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
bool sendAllSlots;
recvData >> guid >> sendAllSlots;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [%s] AllSlots: %u"
, GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots);
#endif
Guild* const guild = GetPlayer()->GetGuild();
if (!guild)
{
@@ -427,10 +379,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
recvData >> guid >> tabId >> full;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [%s], TabId: %u, ShowTabs: %u"
, GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, full);
#endif
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankTabData(this, tabId);
@@ -442,10 +392,8 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
uint32 money;
recvData >> guid >> money;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [%s], money: %u",
GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
#endif
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (money && GetPlayer()->HasEnoughMoney(money))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -458,10 +406,8 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
uint32 money;
recvData >> guid >> money;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [%s], money: %u",
GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
#endif
if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleMemberWithdrawMoney(this, money);
@@ -469,9 +415,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str());
#endif
ObjectGuid GoGuid;
recvData >> GoGuid;
@@ -557,9 +501,7 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
recvData >> guid >> tabId;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [%s], TabId: %u", GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId);
#endif
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -574,10 +516,8 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData)
recvData >> guid >> tabId >> name >> icon;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [%s], TabId: %u, Name: %s, Icon: %s"
, GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, name.c_str(), icon.c_str());
#endif
// Check for overflow
if (name.length() > 16 || icon.length() > 128)
@@ -597,9 +537,7 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket& recvData)
uint8 tabId;
recvData >> tabId;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId);
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankLog(this, tabId);
@@ -610,9 +548,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket& recvData)
uint8 tabId;
recvData >> tabId;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId);
#endif
if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankTabText(this, tabId);
@@ -624,9 +560,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket& recvData)
std::string text;
recvData >> tabId >> text;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str());
#endif
// Check for overflow
if (text.length() > 500)