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

@@ -46,7 +46,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -70,7 +70,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
uint64 guid;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BANKER_ACTIVATE");
LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
#endif
recvData >> guid;
@@ -79,7 +79,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -123,14 +123,14 @@ void WorldSession::SendTrainerList(uint64 guid)
void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList");
LOG_DEBUG("network", "WORLD: SendTrainerList");
#endif
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -144,7 +144,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (!ci)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
#endif
return;
}
@@ -153,7 +153,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (!trainer_spells)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry());
LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry());
#endif
return;
}
@@ -248,14 +248,14 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
recvData >> guid >> spellId;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
#endif
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -305,7 +305,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO");
LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
#endif
uint64 guid;
@@ -315,7 +315,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -368,7 +368,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION");
LOG_DEBUG("network.opcode", "WORLD: CMSG_GOSSIP_SELECT_OPTION");
#endif
uint32 option;
@@ -381,11 +381,11 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
if (_player->PlayerTalkClass->GossipOptionCoded(option))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_PACKETIO, "reading string");
LOG_DEBUG("network.opcode", "reading string");
#endif
recvData >> code;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_PACKETIO, "string read: %s", code.c_str());
LOG_DEBUG("network.opcode", "string read: %s", code.c_str());
#endif
}
@@ -393,7 +393,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network.opcode", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -417,7 +417,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
#endif
uint64 guid;
@@ -428,7 +428,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
#endif
return;
}
@@ -483,7 +483,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
#endif
return;
}
@@ -517,7 +517,7 @@ void WorldSession::SendBindPoint(Creature* npc)
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS");
LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
#endif
uint64 npcGUID;
@@ -555,7 +555,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS Send.");
LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send.");
#endif
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
@@ -630,7 +630,7 @@ void WorldSession::SendStableResult(uint8 res)
void WorldSession::HandleStablePet(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET");
LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
#endif
uint64 npcGUID;
@@ -737,7 +737,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET.");
LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
#endif
uint64 npcGUID;
uint32 petnumber;
@@ -840,7 +840,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
#endif
uint64 npcGUID;
@@ -875,14 +875,14 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
void WorldSession::HandleStableRevivePet(WorldPacket& /* recvData */)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented");
LOG_DEBUG("network", "HandleStableRevivePet: Not implemented");
#endif
}
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
#endif
uint64 npcGUID;
uint32 petId;
@@ -995,7 +995,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM");
LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
#endif
uint64 npcGUID, itemGUID;
@@ -1007,7 +1007,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
if (!unit)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
#endif
return;
}
@@ -1024,7 +1024,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
if (itemGUID)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
#endif
Item* item = _player->GetItemByGuid(itemGUID);
@@ -1034,7 +1034,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
#endif
_player->DurabilityRepairAll(true, discountMod, guildBank);
}