mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-16 00:36:07 +00:00
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:
@@ -140,7 +140,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
owner->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
if (!pet->IsPositionValid())
|
||||
{
|
||||
sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
|
||||
LOG_ERROR("server", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
|
||||
delete pet;
|
||||
delete holder;
|
||||
return PET_LOAD_ERROR;
|
||||
@@ -196,7 +196,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
break;
|
||||
default:
|
||||
if (!pet->IsPetGhoul())
|
||||
sLog->outError("Pet have incorrect type (%u) for pet loading.", pet->getPetType());
|
||||
LOG_ERROR("server", "Pet have incorrect type (%u) for pet loading.", pet->getPetType());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
|
||||
#endif
|
||||
|
||||
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
@@ -366,7 +366,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
if (!pet)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
|
||||
LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -393,18 +393,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
// used also for charmed creature
|
||||
Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
|
||||
LOG_DEBUG("server", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
|
||||
#endif
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
sLog->outError("HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetFirstControlled())
|
||||
{
|
||||
sLog->outError("HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,20 +449,20 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recvData)
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
|
||||
#endif
|
||||
|
||||
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
sLog->outError("HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
|
||||
{
|
||||
sLog->outError("HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
LOG_ERROR("server", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
|
||||
return;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
LOG_ERROR("server", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
}
|
||||
break;
|
||||
case ACT_REACTION: // 0x6
|
||||
@@ -667,7 +667,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("WORLD: unknown PET spell id %i", spellid);
|
||||
LOG_ERROR("server", "WORLD: unknown PET spell id %i", spellid);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -898,14 +898,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
LOG_ERROR("server", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY");
|
||||
LOG_DEBUG("server", "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
|
||||
#endif
|
||||
|
||||
uint32 petnumber;
|
||||
@@ -969,7 +969,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -980,7 +980,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -991,7 +991,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION");
|
||||
LOG_DEBUG("server", "HandlePetSetAction. CMSG_PET_SET_ACTION");
|
||||
#endif
|
||||
|
||||
uint64 petguid;
|
||||
@@ -1002,7 +1002,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
Unit* checkPet = ObjectAccessor::GetUnit(*_player, petguid);
|
||||
if (!checkPet || checkPet != _player->GetFirstControlled())
|
||||
{
|
||||
sLog->outError("HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
|
||||
LOG_ERROR("server", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetRename. CMSG_PET_RENAME");
|
||||
LOG_DEBUG("server", "HandlePetRename. CMSG_PET_RENAME");
|
||||
#endif
|
||||
|
||||
uint64 petguid;
|
||||
@@ -1212,7 +1212,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
uint64 guid;
|
||||
recvData >> guid; //pet guid
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
|
||||
#endif
|
||||
|
||||
if (!_player->IsInWorld())
|
||||
@@ -1240,7 +1240,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("CMSG_PET_SPELL_AUTOCAST");
|
||||
LOG_DEBUG("server", "CMSG_PET_SPELL_AUTOCAST");
|
||||
#endif
|
||||
uint64 guid;
|
||||
uint32 spellid;
|
||||
@@ -1260,7 +1260,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm()))
|
||||
{
|
||||
sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1284,7 +1284,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1300,7 +1300,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL");
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
@@ -1311,7 +1311,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
recvPacket >> guid >> castCount >> spellId >> castFlags;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);
|
||||
#endif
|
||||
|
||||
// This opcode is also sent from charmed and possessed units (players and creatures)
|
||||
@@ -1322,14 +1322,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
|
||||
{
|
||||
sLog->outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("WORLD: unknown PET spell id %i", spellId);
|
||||
LOG_ERROR("server", "WORLD: unknown PET spell id %i", spellId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1421,7 +1421,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
|
||||
void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_LEARN_TALENT");
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
@@ -1435,7 +1435,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
|
||||
void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET");
|
||||
LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
|
||||
Reference in New Issue
Block a user