mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
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:
@@ -214,7 +214,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
if (!m_Socket)
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(ACORE_DEBUG)
|
||||
#if defined(ACORE_DEBUG)
|
||||
// Code for network use statistic
|
||||
static uint64 sendPacketCount = 0;
|
||||
static uint64 sendPacketBytes = 0;
|
||||
@@ -240,9 +240,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
uint64 minTime = uint64(cur_time - lastTime);
|
||||
uint64 fullTime = uint64(lastTime - firstTime);
|
||||
|
||||
LOG_DEBUG("server", "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: " 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("server", "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: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
|
||||
lastTime = cur_time;
|
||||
sendLastPacketCount = 1;
|
||||
@@ -393,7 +393,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
LOG_ERROR("server", "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: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
{
|
||||
LOG_DEBUG("network", "Dumping error causing packet:");
|
||||
@@ -665,9 +665,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
//! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle
|
||||
WorldPacket data(SMSG_LOGOUT_COMPLETE, 0);
|
||||
SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||
#endif
|
||||
|
||||
//! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE);
|
||||
@@ -794,13 +792,13 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
uint32 type = fields[0].GetUInt8();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
LOG_ERROR("server", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("network", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((mask & (1 << type)) == 0)
|
||||
{
|
||||
LOG_ERROR("server", "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 `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1054,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
|
||||
if (size > 0xFFFFF)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
LOG_ERROR("network", "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1086,34 +1084,28 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
|
||||
addonInfo >> enabled >> crc >> unk1;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
#endif
|
||||
LOG_DEBUG("network", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
|
||||
AddonInfo addon(addonName, enabled, crc, 2, true);
|
||||
|
||||
SavedAddon const* savedAddon = AddonMgr::GetAddonInfo(addonName);
|
||||
if (savedAddon)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
bool match = true;
|
||||
|
||||
if (addon.CRC != savedAddon->CRC)
|
||||
match = false;
|
||||
|
||||
if (!match)
|
||||
LOG_DEBUG("server", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("network", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
else
|
||||
LOG_DEBUG("server", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
#endif
|
||||
LOG_DEBUG("network", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddonMgr::SaveAddon(addon);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
#endif
|
||||
LOG_DEBUG("network", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
}
|
||||
|
||||
// TODO: Find out when to not use CRC/pubkey, and other possible states.
|
||||
@@ -1122,17 +1114,13 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
|
||||
uint32 currentTime;
|
||||
addonInfo >> currentTime;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (addonInfo.rpos() != addonInfo.size())
|
||||
LOG_DEBUG("network", "packet under-read!");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "Addon packet uncompress error!");
|
||||
LOG_ERROR("network", "Addon packet uncompress error!");
|
||||
}
|
||||
|
||||
void WorldSession::SendAddonsInfo()
|
||||
@@ -1171,9 +1159,7 @@ void WorldSession::SendAddonsInfo()
|
||||
data << uint8(usepk);
|
||||
if (usepk) // if CRC is wrong, add public key (client need it)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "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);
|
||||
#endif
|
||||
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);
|
||||
data.append(addonPublicKey, sizeof(addonPublicKey));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user