Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
Memleak fix
This commit is contained in:
1 parent
243c325ca4
commit
d1677b2db0
240 files changed
+4580
-4563
No files matched your search
@@ -221,7 +221,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
do
|
||||
{
|
||||
uint32 guidlow = (*result)[0].GetUInt32();
|
||||
sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
|
||||
TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
|
||||
if (Player::BuildEnumData(result, &data))
|
||||
{
|
||||
_legitCharacters.insert(guidlow);
|
||||
@@ -305,7 +305,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
data << uint8(CHAR_CREATE_FAILED);
|
||||
SendPacket(&data);
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
data << uint8(CHAR_CREATE_FAILED);
|
||||
SendPacket(&data);
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
if (raceEntry->expansion > Expansion())
|
||||
{
|
||||
data << uint8(CHAR_CREATE_EXPANSION);
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
if (classEntry->expansion > Expansion())
|
||||
{
|
||||
data << uint8(CHAR_CREATE_EXPANSION_CLASS);
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
data << uint8(CHAR_NAME_NO_NAME);
|
||||
SendPacket(&data);
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
{
|
||||
uint8 unk;
|
||||
createInfo->Data >> unk;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk);
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk);
|
||||
}
|
||||
|
||||
Player newChar(this);
|
||||
@@ -677,7 +677,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
SendPacket(&data);
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
sScriptMgr->OnPlayerCreate(&newChar);
|
||||
sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
|
||||
|
||||
@@ -736,7 +736,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
|
||||
TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
|
||||
sScriptMgr->OnPlayerDelete(guid);
|
||||
|
||||
if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
|
||||
@@ -758,20 +758,20 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (PlayerLoading() || GetPlayer() != NULL)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId());
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
m_playerLoading = true;
|
||||
uint64 playerGuid = 0;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message");
|
||||
|
||||
recvData >> playerGuid;
|
||||
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
|
||||
KickPlayer();
|
||||
return;
|
||||
}
|
||||
@@ -855,13 +855,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
data.put(0, linecount);
|
||||
|
||||
SendPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)");
|
||||
|
||||
// send server info
|
||||
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
|
||||
chH.PSendSysMessage(_FULLVERSION);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent server info");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent server info");
|
||||
}
|
||||
|
||||
//QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow());
|
||||
@@ -884,7 +884,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
else
|
||||
{
|
||||
// remove wrong guild data
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
|
||||
pCurrChar->SetInGuild(0);
|
||||
}
|
||||
}
|
||||
@@ -924,7 +924,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
}
|
||||
|
||||
sObjectAccessor->AddObject(pCurrChar);
|
||||
//sLog->outDebug("Player %s added to Map.", pCurrChar->GetName().c_str());
|
||||
//TC_LOG_DEBUG("Player %s added to Map.", pCurrChar->GetName().c_str());
|
||||
|
||||
pCurrChar->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
@@ -1011,7 +1011,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
SendNotification(LANG_GM_ON);
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
|
||||
TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
|
||||
|
||||
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
|
||||
@@ -1025,7 +1025,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
|
||||
void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
|
||||
|
||||
uint32 repListID;
|
||||
uint8 flag;
|
||||
@@ -1039,7 +1039,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
|
||||
//I think this function is never used :/ I dunno, but i guess this opcode not exists
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
|
||||
GetPlayer()->GetReputationMgr().SendStates();
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/)
|
||||
|
||||
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
|
||||
uint32 fact;
|
||||
recvData >> fact;
|
||||
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
|
||||
@@ -1081,7 +1081,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
|
||||
uint32 replistid;
|
||||
uint8 inactive;
|
||||
recvData >> replistid >> inactive;
|
||||
@@ -1091,14 +1091,14 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str());
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str());
|
||||
recvData.read_skip<uint8>(); // unknown, bool?
|
||||
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
|
||||
}
|
||||
|
||||
void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str());
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str());
|
||||
recvData.read_skip<uint8>(); // unknown, bool?
|
||||
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
|
||||
}
|
||||
@@ -1188,7 +1188,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
|
||||
TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
|
||||
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
@@ -1298,7 +1298,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleAlterAppearance(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE");
|
||||
|
||||
uint32 Hair, Color, FacialHair, SkinColor;
|
||||
recvData >> Hair >> Color >> FacialHair >> SkinColor;
|
||||
@@ -1375,7 +1375,7 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
|
||||
|
||||
if (slot >= MAX_GLYPH_SLOT_INDEX)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
recvData >> guid;
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer();
|
||||
@@ -1481,7 +1481,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
if (result)
|
||||
{
|
||||
std::string oldname = result->Fetch()[0].GetString();
|
||||
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
|
||||
TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
|
||||
}
|
||||
|
||||
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
|
||||
@@ -1517,7 +1517,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE");
|
||||
|
||||
uint64 setGuid;
|
||||
recvData.readPackGUID(setGuid);
|
||||
@@ -1569,7 +1569,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
|
||||
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE");
|
||||
|
||||
uint64 setGuid;
|
||||
recvData.readPackGUID(setGuid);
|
||||
@@ -1582,7 +1582,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
if (_player->isInCombat())
|
||||
return;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE");
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE");
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
@@ -1592,7 +1592,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
uint8 srcbag, srcslot;
|
||||
recvData >> srcbag >> srcslot;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
|
||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||
if (itemGuid == 1)
|
||||
@@ -1641,7 +1641,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer();
|
||||
@@ -2163,7 +2163,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog->outDebug(LOG_FILTER_PLAYER, "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race);
|
||||
TC_LOG_DEBUG(LOG_FILTER_PLAYER, "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race);
|
||||
|
||||
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1 + 8 + (newname.size() + 1) + 1 + 1 + 1 + 1 + 1 + 1 + 1);
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
|
||||
Reference in new issue
Block a user