mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +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:
@@ -31,7 +31,7 @@
|
||||
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got MSG_MOVE_WORLDPORT_ACK.");
|
||||
LOG_DEBUG("network", "WORLD: got MSG_MOVE_WORLDPORT_ACK.");
|
||||
#endif
|
||||
HandleMoveWorldportAckOpcode();
|
||||
}
|
||||
@@ -61,7 +61,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
Map* oldMap = GetPlayer()->GetMap();
|
||||
if (GetPlayer()->IsInWorld())
|
||||
{
|
||||
sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId());
|
||||
LOG_ERROR("server", "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId());
|
||||
oldMap->RemovePlayerFromMap(GetPlayer(), false);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
// while the player is in transit, for example the map may get full
|
||||
if (!newMap || !newMap->CanEnter(GetPlayer(), false))
|
||||
{
|
||||
sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
GetPlayer()->SendInitialPacketsBeforeAddToMap();
|
||||
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
|
||||
{
|
||||
sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
|
||||
LOG_ERROR("server", "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
|
||||
GetPlayer()->ResetMap();
|
||||
GetPlayer()->SetMap(oldMap);
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
@@ -227,7 +227,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_MOVE_TELEPORT_ACK");
|
||||
LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK");
|
||||
#endif
|
||||
uint64 guid;
|
||||
|
||||
@@ -236,10 +236,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
uint32 flags, time;
|
||||
recvData >> flags >> time; // unused
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Guid " UI64FMTD, guid);
|
||||
LOG_DEBUG("server", "Guid " UI64FMTD, guid);
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Flags %u, time %u", flags, time / IN_MILLISECONDS);
|
||||
LOG_DEBUG("server", "Flags %u, time %u", flags, time / IN_MILLISECONDS);
|
||||
#endif
|
||||
|
||||
Player* plMover = _player->m_mover->ToPlayer();
|
||||
@@ -515,7 +515,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
{
|
||||
uint32 opcode = recvData.GetOpcode();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||
LOG_DEBUG("network", "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||
#endif
|
||||
|
||||
/* extract packet */
|
||||
@@ -589,7 +589,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
force_move_type = MOVE_PITCH_RATE;
|
||||
break;
|
||||
default:
|
||||
sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
|
||||
LOG_ERROR("server", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -606,13 +606,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
{
|
||||
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
|
||||
{
|
||||
sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
|
||||
LOG_ERROR("server", "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
|
||||
move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed);
|
||||
_player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true);
|
||||
}
|
||||
else // must be lesser - cheating
|
||||
{
|
||||
sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
|
||||
LOG_INFO("server", "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
|
||||
_player->GetName().c_str(), GetAccountId(), _player->GetSpeed(move_type), newspeed);
|
||||
KickPlayer("Incorrect speed");
|
||||
}
|
||||
@@ -622,7 +622,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
@@ -631,14 +631,14 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData)
|
||||
if (GetPlayer()->IsInWorld() && _player->m_mover && _player->m_mover->IsInWorld())
|
||||
{
|
||||
if (_player->m_mover->GetGUID() != guid)
|
||||
sLog->outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
|
||||
LOG_ERROR("server", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveNotActiveMover(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||
#endif
|
||||
|
||||
uint64 old_mover_guid;
|
||||
@@ -669,7 +669,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/)
|
||||
void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
|
||||
LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
@@ -706,7 +706,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_HOVER_ACK");
|
||||
LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid; // guid - unused
|
||||
@@ -724,7 +724,7 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
|
||||
void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_WATER_WALK_ACK");
|
||||
LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid; // guid - unused
|
||||
@@ -766,7 +766,7 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED");
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
@@ -778,14 +778,14 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!mover)
|
||||
{
|
||||
sLog->outError("WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent tampered movement data
|
||||
if (guid != mover->GetGUID())
|
||||
{
|
||||
sLog->outError("WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user