mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
refactor(Core/Logging): switch to fmt style for LOG_ (#10366)
* feat(Core/Common): add support fmt style for ASSERT and ABORT * correct CheckCompactArrayMaskOverflow * 1 * Update src/server/game/Spells/Spell.cpp * rework logging * add fmt replace logs * logging * FMT_LOG_ * settings * fix startup * 1 * 2 * 3 * 4 * 5 * fmt::print * to fmt
This commit is contained in:
@@ -77,19 +77,19 @@ void OpcodeTable::ValidateAndSetClientOpcode(OpcodeClient opcode, char const* na
|
||||
{
|
||||
if (uint32(opcode) == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network", "Opcode %s does not have a value", name);
|
||||
LOG_ERROR("network", "Opcode {} does not have a value", name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32(opcode) >= NUM_OPCODE_HANDLERS)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode %u", uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode {}", uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_internalTableClient[opcode] != nullptr)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to override client handler of %s with %s (opcode %u)", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to override client handler of {} with {} (opcode {})", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,19 +100,19 @@ void OpcodeTable::ValidateAndSetServerOpcode(OpcodeServer opcode, char const* na
|
||||
{
|
||||
if (uint32(opcode) == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network", "Opcode %s does not have a value", name);
|
||||
LOG_ERROR("network", "Opcode {} does not have a value", name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32(opcode) >= NUM_OPCODE_HANDLERS)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode %u", uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode {}", uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_internalTableClient[opcode] != nullptr)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to override server handler of %s with %s (opcode %u)", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to override server handler of {} with {} (opcode {})", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ struct ServerPktHeader
|
||||
uint8 headerIndex=0;
|
||||
if (isLargePacket())
|
||||
{
|
||||
LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
|
||||
LOG_DEBUG("network", "initializing large server to client packet. Size: {}, cmd: {}", size, cmd);
|
||||
header[headerIndex++] = 0x80 | (0xFF & (size >> 16));
|
||||
}
|
||||
header[headerIndex++] = 0xFF &(size >> 8);
|
||||
|
||||
@@ -208,7 +208,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
{
|
||||
if (packet->GetOpcode() == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "%s send NULL_OPCODE", GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "{} send NULL_OPCODE", GetPlayerInfo());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -241,9 +241,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
uint64 minTime = uint64(cur_time - lastTime);
|
||||
uint64 fullTime = uint64(lastTime - firstTime);
|
||||
|
||||
LOG_DEBUG("network", "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
LOG_DEBUG("network", "Send all time packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {} time: {}", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
|
||||
LOG_DEBUG("network", "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
LOG_DEBUG("network", "Send last min packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {}", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
|
||||
lastTime = cur_time;
|
||||
sendLastPacketCount = 1;
|
||||
@@ -256,7 +256,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
|
||||
LOG_TRACE("network.opcode", "S->C: {} {}", GetPlayerInfo(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())));
|
||||
m_Socket->SendPacket(*packet);
|
||||
}
|
||||
|
||||
@@ -269,8 +269,8 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
|
||||
/// Logging helper for unexpected opcodes
|
||||
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, char const* status, const char* reason)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received unexpected opcode %s Status: %s Reason: %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), status, reason, GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received unexpected opcode {} Status: {} Reason: {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), status, reason, GetPlayerInfo());
|
||||
}
|
||||
|
||||
/// Logging helper for unexpected opcodes
|
||||
@@ -279,8 +279,8 @@ void WorldSession::LogUnprocessedTail(WorldPacket* packet)
|
||||
if (!sLog->ShouldLog("network.opcode", LogLevel::LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
|
||||
return;
|
||||
|
||||
LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
|
||||
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at {} from {}) Opcode {} from {}",
|
||||
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
|
||||
packet->print_storage();
|
||||
}
|
||||
@@ -378,19 +378,19 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
break;
|
||||
case STATUS_NEVER:
|
||||
LOG_ERROR("network.opcode", "Received not allowed opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received not allowed opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
break;
|
||||
case STATUS_UNHANDLED:
|
||||
LOG_DEBUG("network.opcode", "Received not handled opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_DEBUG("network.opcode", "Received not handled opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (WorldPackets::InvalidHyperlinkException const& ihe)
|
||||
{
|
||||
LOG_ERROR("network", "%s sent %s with an invalid link:\n%s", GetPlayerInfo().c_str(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
LOG_ERROR("network", "{} sent {} with an invalid link:\n{}", GetPlayerInfo(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), ihe.GetInvalidValue());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
{
|
||||
@@ -399,8 +399,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (WorldPackets::IllegalHyperlinkException const& ihe)
|
||||
{
|
||||
LOG_ERROR("network", "%s sent %s which illegally contained a hyperlink:\n%s", GetPlayerInfo().c_str(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
LOG_ERROR("network", "{} sent {} which illegally contained a hyperlink:\n{}", GetPlayerInfo(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), ihe.GetInvalidValue());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
{
|
||||
@@ -409,12 +409,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (WorldPackets::PacketArrayMaxCapacityException const& pamce)
|
||||
{
|
||||
LOG_ERROR("network", "PacketArrayMaxCapacityException: %s while parsing %s from %s.",
|
||||
pamce.what(), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network", "PacketArrayMaxCapacityException: {} while parsing {} from {}.",
|
||||
pamce.what(), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
LOG_ERROR("network", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: {}) from client {}, accountid={}. Skipped packet.", packet->GetOpcode(), GetRemoteAddress(), GetAccountId());
|
||||
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
{
|
||||
LOG_DEBUG("network", "Dumping error causing packet:");
|
||||
@@ -671,8 +671,8 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
|
||||
METRIC_EVENT("player_events", "Logout", _player->GetName());
|
||||
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Logout Character:[%s] (%s) Level: %d",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), _player->getLevel());
|
||||
LOG_INFO("entities.player", "Account: {} (IP: {}) Logout Character:[{}] ({}) Level: {}",
|
||||
GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().ToString(), _player->getLevel());
|
||||
|
||||
//! Remove the player from the world
|
||||
// the player may not be in the world when logging out
|
||||
@@ -708,8 +708,8 @@ void WorldSession::KickPlayer(std::string const& reason, bool setKicked)
|
||||
{
|
||||
if (m_Socket)
|
||||
{
|
||||
LOG_INFO("network.kick", "Account: %u Character: '%s' %s kicked with reason: %s", GetAccountId(), _player ? _player->GetName().c_str() : "<none>",
|
||||
_player ? _player->GetGUID().ToString().c_str() : "", reason.c_str());
|
||||
LOG_INFO("network.kick", "Account: {} Character: '{}' {} kicked with reason: {}", GetAccountId(), _player ? _player->GetName() : "<none>",
|
||||
_player ? _player->GetGUID().ToString() : "", reason);
|
||||
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
@@ -723,8 +723,8 @@ bool WorldSession::ValidateHyperlinksAndMaybeKick(std::string_view str)
|
||||
if (Acore::Hyperlinks::CheckAllLinks(str))
|
||||
return true;
|
||||
|
||||
LOG_ERROR("network", "Player %s%s sent a message with an invalid link:\n%.*s", GetPlayer()->GetName().c_str(),
|
||||
GetPlayer()->GetGUID().ToString().c_str(), STRING_VIEW_FMT_ARG(str));
|
||||
LOG_ERROR("network", "Player {}{} sent a message with an invalid link:\n%.*s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
|
||||
@@ -737,8 +737,8 @@ bool WorldSession::DisallowHyperlinksAndMaybeKick(std::string_view str)
|
||||
if (str.find('|') == std::string_view::npos)
|
||||
return true;
|
||||
|
||||
LOG_ERROR("network", "Player %s %s sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName().c_str(),
|
||||
GetPlayer()->GetGUID().ToString().c_str(), STRING_VIEW_FMT_ARG(str));
|
||||
LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
|
||||
@@ -788,26 +788,26 @@ char const* WorldSession::GetAcoreString(uint32 entry) const
|
||||
|
||||
void WorldSession::Handle_NULL(WorldPacket& null)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(null.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received unhandled opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(null.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received opcode %s that must be processed in WorldSocket::ReadDataHandler from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received opcode {} that must be processed in WorldSocket::ReadDataHandler from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received server-side opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeServer>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received server-side opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeServer>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received deprecated opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received deprecated opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::SendAuthWaitQueue(uint32 position)
|
||||
@@ -850,13 +850,13 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
uint32 type = fields[0].GetUInt8();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
LOG_ERROR("network", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("network", "Table `{}` have invalid account data type ({}), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((mask & (1 << type)) == 0)
|
||||
{
|
||||
LOG_ERROR("network", "Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("network", "Table `{}` have non appropriate for table account data type ({}), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -989,9 +989,9 @@ void WorldSession::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
|
||||
{ \
|
||||
if (check) \
|
||||
{ \
|
||||
LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \
|
||||
"MovementFlags: %u, MovementFlags2: %u for player %s. Mask %u will be removed.", \
|
||||
STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUID().ToString().c_str(), maskToRemove); \
|
||||
LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found ({}). " \
|
||||
"MovementFlags: {}, MovementFlags2: {} for player {}. Mask {} will be removed.", \
|
||||
STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUID().ToString(), maskToRemove); \
|
||||
mi->RemoveMovementFlag((maskToRemove)); \
|
||||
} \
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
if (size > 0xFFFFF)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
LOG_ERROR("network", "WorldSession::ReadAddonsInfo addon info too big, size {}", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1142,7 +1142,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
addonInfo >> enabled >> crc >> unk1;
|
||||
|
||||
LOG_DEBUG("network", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
LOG_DEBUG("network", "ADDON: Name: {}, Enabled: 0x{:x}, CRC: 0x{:x}, Unknown2: 0x{:x}", addonName, enabled, crc, unk1);
|
||||
|
||||
AddonInfo addon(addonName, enabled, crc, 2, true);
|
||||
|
||||
@@ -1155,15 +1155,15 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
match = false;
|
||||
|
||||
if (!match)
|
||||
LOG_DEBUG("network", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} was known, but didn't match known CRC (0x{:x})!", addon.Name, savedAddon->CRC);
|
||||
else
|
||||
LOG_DEBUG("network", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} was known, CRC is correct (0x{:x})", addon.Name, savedAddon->CRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddonMgr::SaveAddon(addon);
|
||||
|
||||
LOG_DEBUG("network", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} (0x{:x}) was not known, saving...", addon.Name, addon.CRC);
|
||||
}
|
||||
|
||||
// TODO: Find out when to not use CRC/pubkey, and other possible states.
|
||||
@@ -1172,7 +1172,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
uint32 currentTime;
|
||||
addonInfo >> currentTime;
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime);
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: {}", currentTime);
|
||||
|
||||
if (addonInfo.rpos() != addonInfo.size())
|
||||
LOG_DEBUG("network", "packet under-read!");
|
||||
@@ -1217,7 +1217,7 @@ void WorldSession::SendAddonsInfo()
|
||||
data << uint8(usepk);
|
||||
if (usepk) // if CRC is wrong, add public key (client need it)
|
||||
{
|
||||
LOG_DEBUG("network", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
|
||||
LOG_DEBUG("network", "ADDON: CRC (0x{:x}) for addon {} is wrong (does not match expected 0x{:x}), sending pubkey", itr->CRC, itr->Name, STANDARD_ADDON_CRC);
|
||||
data.append(addonPublicKey, sizeof(addonPublicKey));
|
||||
}
|
||||
|
||||
@@ -1307,8 +1307,8 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
if (++packetCounter.amountCounter <= maxPacketCounterAllowed)
|
||||
return true;
|
||||
|
||||
LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Ping: %u, Character: %s, flooding packet (opc: %s (0x%X), count: %u)",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(),
|
||||
LOG_WARN("network", "AntiDOS: Account {}, IP: {}, Ping: {}, Character: {}, flooding packet (opc: {} (0x{:X}), count: {})",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress(), Session->GetLatency(), Session->GetPlayerName(),
|
||||
opcodeTable[static_cast<OpcodeClient>(p.GetOpcode())]->Name, p.GetOpcode(), packetCounter.amountCounter);
|
||||
|
||||
switch (_policy)
|
||||
@@ -1317,7 +1317,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
return true;
|
||||
case POLICY_KICK:
|
||||
{
|
||||
LOG_INFO("network", "AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str());
|
||||
LOG_INFO("network", "AntiDOS: Player {} kicked!", Session->GetPlayerName());
|
||||
Session->KickPlayer();
|
||||
return false;
|
||||
}
|
||||
@@ -1338,7 +1338,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_INFO("network", "AntiDOS: Player automatically banned for %u seconds.", duration);
|
||||
LOG_INFO("network", "AntiDOS: Player automatically banned for {} seconds.", duration);
|
||||
return false;
|
||||
}
|
||||
default: // invalid policy
|
||||
|
||||
@@ -69,7 +69,7 @@ void WorldSocket::CheckIpCallback(PreparedQueryResult result)
|
||||
if (banned)
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::CheckIpCallback: Sent Auth Response (IP %s banned).", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::CheckIpCallback: Sent Auth Response (IP {} banned).", GetRemoteIpAddress().to_string());
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -223,8 +223,8 @@ bool WorldSocket::ReadHeaderHandler()
|
||||
|
||||
if (!header->IsValidSize() || !header->IsValidOpcode())
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::ReadHeaderHandler(): client %s sent malformed packet (size: %hu, cmd: %u)",
|
||||
GetRemoteIpAddress().to_string().c_str(), header->size, header->cmd);
|
||||
LOG_ERROR("network", "WorldSocket::ReadHeaderHandler(): client {} sent malformed packet (size: {}, cmd: {})",
|
||||
GetRemoteIpAddress().to_string(), header->size, header->cmd);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
}
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_PING", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client {} sent malformed CMSG_PING", GetRemoteIpAddress().to_string());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_AUTH_SESSION:
|
||||
@@ -337,7 +337,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
{
|
||||
// locking just to safely log offending user is probably overkill but we are disconnecting him anyway
|
||||
if (sessionGuard.try_lock())
|
||||
LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from {}", _worldSession->GetPlayerInfo());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
}
|
||||
catch (ByteBufferException const&) { }
|
||||
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_AUTH_SESSION", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client {} sent malformed CMSG_AUTH_SESSION", GetRemoteIpAddress().to_string());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_KEEP_ALIVE: // todo: handle this packet in the same way of CMSG_TIME_SYNC_RESP
|
||||
@@ -371,7 +371,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
|
||||
if (!_worldSession)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
|
||||
LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = {}", uint32(opcode));
|
||||
delete packetToQueue;
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
@@ -379,7 +379,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
OpcodeHandler const* handler = opcodeTable[opcode];
|
||||
if (!handler)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "No defined handler for opcode %s sent by %s", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet.GetOpcode())).c_str(), _worldSession->GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "No defined handler for opcode {} sent by {}", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet.GetOpcode())), _worldSession->GetPlayerInfo());
|
||||
delete packetToQueue;
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
@@ -397,18 +397,18 @@ void WorldSocket::LogOpcodeText(OpcodeClient opcode, std::unique_lock<std::mutex
|
||||
{
|
||||
if (!guard)
|
||||
{
|
||||
LOG_TRACE("network.opcode", "C->S: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(opcode).c_str());
|
||||
LOG_TRACE("network.opcode", "C->S: {} {}", GetRemoteIpAddress().to_string(), GetOpcodeNameForLogging(opcode));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(),
|
||||
GetOpcodeNameForLogging(opcode).c_str());
|
||||
LOG_TRACE("network.opcode", "C->S: {} {}", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()),
|
||||
GetOpcodeNameForLogging(opcode));
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSocket::SendPacketAndLogOpcode(WorldPacket const& packet)
|
||||
{
|
||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet.GetOpcode())).c_str());
|
||||
LOG_TRACE("network.opcode", "S->C: {} {}", GetRemoteIpAddress().to_string(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet.GetOpcode())));
|
||||
SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (sWorld->IsClosed())
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client ({}).", GetRemoteIpAddress().to_string());
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -490,8 +490,8 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (authSession->RealmID != realm.Id.Realm)
|
||||
{
|
||||
SendAuthResponseError(REALM_LIST_REALM_NOT_FOUND);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
|
||||
GetRemoteIpAddress().to_string().c_str(), authSession->RealmID, realm.Id.Realm);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client {} requested connecting with realm id {} but this realm has id {} set in config.",
|
||||
GetRemoteIpAddress().to_string(), authSession->RealmID, realm.Id.Realm);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (wardenActive && account.OS != "Win" && account.OS != "OSX")
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), account.OS.c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client {} attempted to log in using invalid client OS ({}).", address, account.OS);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (sha.GetDigest() != authSession->Digest)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Id, authSession->Account.c_str(), address.c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: {} ('{}') address: {}", account.Id, authSession->Account, address);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (account.LastIP != address)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", account.LastIP.c_str(), address.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: {}, new IP: {}).", account.LastIP, address);
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
DelayedCloseSocket();
|
||||
@@ -546,7 +546,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (account.LockCountry != _ipCountry)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.LockCountry.c_str(), _ipCountry.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: {}, new country: {}).", account.LockCountry, _ipCountry);
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
DelayedCloseSocket();
|
||||
@@ -576,7 +576,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
|
||||
// Check locked state for server
|
||||
AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
|
||||
LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, account.Security);
|
||||
LOG_DEBUG("network", "Allowed Level: {} Player Level {}", allowedAccountType, account.Security);
|
||||
if (allowedAccountType > SEC_PLAYER && account.Security < allowedAccountType)
|
||||
{
|
||||
SendAuthResponseError(AUTH_UNAVAILABLE);
|
||||
@@ -586,7 +586,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", authSession->Account.c_str(), address.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '{}' authenticated successfully from {}.", authSession->Account, address);
|
||||
|
||||
// Update the last_ip in the database as it was successful for login
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP);
|
||||
@@ -660,8 +660,8 @@ bool WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
|
||||
if (_worldSession && AccountMgr::IsPlayerAccount(_worldSession->GetSecurity()))
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
|
||||
_worldSession->GetPlayerInfo().c_str(), GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: {} kicked for over-speed pings (address: {})",
|
||||
_worldSession->GetPlayerInfo(), GetRemoteIpAddress().to_string());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -680,7 +680,7 @@ bool WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
_worldSession->SetLatency(latency);
|
||||
else
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = %s", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = {}", GetRemoteIpAddress().to_string());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ bool WorldSocketMgr::StartWorldNetwork(Acore::Asio::IoContext& ioContext, std::s
|
||||
_tcpNoDelay = sConfigMgr->GetOption<bool>("Network.TcpNodelay", true);
|
||||
|
||||
int const max_connections = ACORE_MAX_LISTEN_CONNECTIONS;
|
||||
LOG_DEBUG("network", "Max allowed socket connections %d", max_connections);
|
||||
LOG_DEBUG("network", "Max allowed socket connections {}", max_connections);
|
||||
|
||||
// -1 means use default
|
||||
_socketSystemSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutKBuff", -1);
|
||||
@@ -91,7 +91,7 @@ void WorldSocketMgr::OnSocketOpen(tcp::socket&& sock, uint32 threadIndex)
|
||||
|
||||
if (err && err != boost::system::errc::not_supported)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::socket_base::send_buffer_size) err = %s", err.message().c_str());
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::socket_base::send_buffer_size) err = {}", err.message());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ void WorldSocketMgr::OnSocketOpen(tcp::socket&& sock, uint32 threadIndex)
|
||||
|
||||
if (err)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::ip::tcp::no_delay) err = %s", err.message().c_str());
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::ip::tcp::no_delay) err = {}", err.message());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user