mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +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:
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("misc", "Account %u not found in login database when processing .account 2fa setup command.", accountId);
|
||||
LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
|
||||
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("misc", "Account %u not found in login database when processing .account 2fa setup command.", accountId);
|
||||
LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
|
||||
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
bool success = Acore::Crypto::AEDecrypt<Acore::Crypto::AES>(secret, *masterKey);
|
||||
if (!success)
|
||||
{
|
||||
LOG_ERROR("misc", "Account %u has invalid ciphertext in TOTP token.", accountId);
|
||||
LOG_ERROR("misc", "Account {} has invalid ciphertext in TOTP token.", accountId);
|
||||
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
@@ -301,9 +301,9 @@ public:
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
|
||||
if (handler->GetSession())
|
||||
{
|
||||
LOG_DEBUG("warden", "Account: %d (IP: %s) Character:[%s] (%s) Change Password.",
|
||||
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
|
||||
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str());
|
||||
LOG_DEBUG("warden", "Account: {} (IP: {}) Character:[{}] ({}) Change Password.",
|
||||
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
|
||||
handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString());
|
||||
}
|
||||
break;
|
||||
case AOR_NAME_TOO_LONG:
|
||||
|
||||
@@ -418,7 +418,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Sending opcode that has unknown type '%s'", type.c_str());
|
||||
LOG_ERROR("network.opcode", "Sending opcode that has unknown type '{}'", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1240,7 +1240,7 @@ public:
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
LOG_INFO("sql.dev", "(@PATH, XX, {0:.3f}, {0:.3f}, {0:.5f}, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
|
||||
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
|
||||
return true;
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
|
||||
{
|
||||
// report to DB errors log as in loading case
|
||||
LOG_ERROR("sql.sql", "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", *objectId, objectInfo->type, objectInfo->displayId);
|
||||
LOG_ERROR("sql.sql", "Gameobject (Entry {} GoType: {}) have invalid displayId ({}), not spawned.", *objectId, objectInfo->type, objectInfo->displayId);
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, uint32(objectId));
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
Movement::PointsArray const& pointPath = path.GetPath();
|
||||
handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str());
|
||||
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useRaycast ? "Raycast" : "SmoothPath");
|
||||
handler->PSendSysMessage("Result: %s - Length: " SZFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
|
||||
handler->PSendSysMessage(Acore::StringFormatFmt("Result: {} - Length: {} - Type: {}", (result ? "true" : "false"), pointPath.size(), path.GetPathType()).c_str());
|
||||
|
||||
G3D::Vector3 const& start = path.GetStartPosition();
|
||||
G3D::Vector3 const& end = path.GetEndPosition();
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
|
||||
if (!creatureList.empty())
|
||||
{
|
||||
handler->PSendSysMessage("Found " SZFMTD " Creatures.", creatureList.size());
|
||||
handler->PSendSysMessage(Acore::StringFormatFmt("Found {} Creatures.", creatureList.size()).c_str());
|
||||
|
||||
uint32 paths = 0;
|
||||
uint32 uStartTime = getMSTime();
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_INFO("server.loading", "Reloading creature template entry %u", entry);
|
||||
LOG_INFO("server.loading", "Reloading creature template entry {}", entry);
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
|
||||
if (!classEntry)
|
||||
{
|
||||
LOG_ERROR("dbc", "Class %u not found in DBC (Wrong DBC files?)", player->getClass());
|
||||
LOG_ERROR("dbc", "Class {} not found in DBC (Wrong DBC files?)", player->getClass());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
dbPort = (*res)[0].GetUInt16();
|
||||
|
||||
if (dbPort)
|
||||
dbPortOutput = Acore::StringFormat("Realmlist (Realm Id: %u) configured in port %" PRIu16, realm.Id.Realm, dbPort);
|
||||
dbPortOutput = Acore::StringFormatFmt("Realmlist (Realm Id: {}) configured in port {}", realm.Id.Realm, dbPort);
|
||||
else
|
||||
dbPortOutput = Acore::StringFormat("Realm Id: %u not found in `realmlist` table. Please check your setup", realm.Id.Realm);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
return val;
|
||||
});
|
||||
|
||||
handler->PSendSysMessage("%s directory located in %s. Total size: " SZFMTD " bytes", subDir.c_str(), mapPath.generic_string().c_str(), folderSize);
|
||||
handler->PSendSysMessage(Acore::StringFormatFmt("{} directory located in {}. Total size: {} bytes", subDir.c_str(), mapPath.generic_string().c_str(), folderSize).c_str());
|
||||
}
|
||||
|
||||
LocaleConstant defaultLocale = sWorld->GetDefaultDbcLocale();
|
||||
|
||||
@@ -447,7 +447,7 @@ public:
|
||||
|
||||
void SetData(uint32 type, uint32 data) override
|
||||
{
|
||||
LOG_DEBUG("scripts.ai", "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
|
||||
LOG_DEBUG("scripts.ai", "Instance Blackrock Depths: SetData update (Type: {} Data {})", type, data);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
|
||||
void PrepareEncounter()
|
||||
{
|
||||
LOG_DEBUG("scripts.ai", "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
|
||||
LOG_DEBUG("scripts.ai", "Barnes Opera Event - Introduction complete - preparing encounter {}", m_uiEventId);
|
||||
uint8 index = 0;
|
||||
uint8 count = 0;
|
||||
|
||||
|
||||
@@ -809,7 +809,7 @@ public:
|
||||
else
|
||||
{
|
||||
me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ());
|
||||
//LOG_DEBUG("scripts.ai", "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ());
|
||||
//LOG_DEBUG("scripts.ai", "npc_unworthy_initiateAI: move to {} {} {}", anchorX, anchorY, me->GetPositionZ());
|
||||
phase = PHASE_EQUIPING;
|
||||
wait_timer = 0;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
|
||||
Cell::VisitGridObjects(me, searcher, me->GetGridActivationRange());
|
||||
|
||||
//LOG_ERROR("scripts", "Eggs %d at middle", templist.size());
|
||||
//LOG_ERROR("scripts", "Eggs {} at middle", templist.size());
|
||||
if (templist.empty())
|
||||
return false;
|
||||
|
||||
@@ -514,7 +514,7 @@ public:
|
||||
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
|
||||
Cell::VisitGridObjects(me, searcher, me->GetGridActivationRange());
|
||||
|
||||
//LOG_ERROR("scripts", "Eggs %d at %d", templist.size(), side);
|
||||
//LOG_ERROR("scripts", "Eggs {} at {}", templist.size(), side);
|
||||
|
||||
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i)
|
||||
if ((*i)->GetDisplayId() != 11686)
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
//LOG_INFO("scripts", "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
|
||||
//LOG_INFO("scripts", "DEBUG: p({}) k({}) d({}) W({})", Phase, KillCount, diff, WaitTimer);
|
||||
|
||||
if (!QuestInProgress)
|
||||
return;
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
// LOG_DEBUG("scripts", "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);
|
||||
// LOG_DEBUG("scripts", "Instance Hyjal: Instance data updated for event {} (Data={})", type, data);
|
||||
|
||||
if (data == DONE)
|
||||
{
|
||||
|
||||
@@ -246,8 +246,8 @@ class spell_rog_deadly_poison : public SpellScript
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
|
||||
if (!spellInfo)
|
||||
{
|
||||
LOG_ERROR("misc", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, %s) cast unknown spell %i",
|
||||
enchant->ID, player->GetName().c_str(), player->GetGUID().ToString().c_str(), enchant->spellid[s]);
|
||||
LOG_ERROR("misc", "Player::CastItemCombatSpell Enchant {}, player (Name: {}, {}) cast unknown spell {}",
|
||||
enchant->ID, player->GetName(), player->GetGUID().ToString(), enchant->spellid[s]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ class spell_warl_create_healthstone : public SpellScript
|
||||
rank = 2;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("spells", "Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
|
||||
LOG_ERROR("spells", "Unknown rank of Improved Healthstone id: {}", aurEff->GetId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,26 +36,26 @@ public:
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_SAY:
|
||||
LOG_CHAT("say", "Player %s says (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
LOG_CHAT("say", "Player {} says (language {}): {}",
|
||||
player->GetName(), lang, msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_EMOTE:
|
||||
LOG_CHAT("emote", "Player %s emotes: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("emote", "Player {} emotes: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_YELL:
|
||||
LOG_CHAT("yell", "Player %s yells (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
LOG_CHAT("yell", "Player {} yells (language {}): {}",
|
||||
player->GetName(), lang, msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override
|
||||
{
|
||||
LOG_CHAT("whisper", "Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("whisper", "Player {} tells {}: {}",
|
||||
player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg);
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
|
||||
@@ -65,38 +65,38 @@ public:
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
LOG_CHAT("party", "Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("party", "Player {} tells group with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
LOG_CHAT("party", "Leader %s tells group: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("party", "Leader {} tells group: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID:
|
||||
LOG_CHAT("raid", "Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("raid", "Player {} tells raid with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
LOG_CHAT("raid", "Leader player %s tells raid: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("raid", "Leader player {} tells raid: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
LOG_CHAT("raid", "Leader player %s warns raid with: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("raid", "Leader player {} warns raid with: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
LOG_CHAT("bg", "Player %s tells battleground with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("bg", "Player {} tells battleground with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND_LEADER:
|
||||
LOG_CHAT("bg", "Leader player %s tells battleground: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("bg", "Leader player {} tells battleground: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -106,13 +106,13 @@ public:
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_GUILD:
|
||||
LOG_CHAT("guild", "Player %s tells guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("guild", "Player {} tells guild {}: {}",
|
||||
player->GetName(), guild ? guild->GetName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_OFFICER:
|
||||
LOG_CHAT("guild.officer", "Player %s tells guild %s officers: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
LOG_CHAT("guild.officer", "Player {} tells guild {} officers: {}",
|
||||
player->GetName(), guild ? guild->GetName() : "<unknown>", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -127,14 +127,14 @@ public:
|
||||
|
||||
if (isSystem)
|
||||
{
|
||||
LOG_CHAT("system", "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channel->GetName().c_str(), msg.c_str());
|
||||
LOG_CHAT("system", "Player {} tells channel {}: {}",
|
||||
player->GetName(), channel->GetName(), msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string channelName = channel ? channel->GetName() : "<unknown>";
|
||||
LOG_CHAT("channel." + channelName, "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channelName.c_str(), msg.c_str());
|
||||
LOG_CHAT("channel." + channelName, "Player {} tells channel {}: {}",
|
||||
player->GetName(), channelName, msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -283,7 +283,7 @@ bool EquippedOk(Player* player, uint32 spellId)
|
||||
if (item && item->GetTemplate()->RequiredSpell == reqSpell)
|
||||
{
|
||||
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
|
||||
LOG_DEBUG("scripts.ai", "Player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
|
||||
LOG_DEBUG("scripts.ai", "Player attempt to unlearn spell {}, but item {} is equipped.", reqSpell, item->GetEntry());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,14 +521,14 @@ public:
|
||||
}
|
||||
|
||||
if (!SpawnAssoc)
|
||||
LOG_ERROR("sql.sql", "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
|
||||
LOG_ERROR("sql.sql", "TCSR: Creature template entry {} has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
|
||||
else
|
||||
{
|
||||
CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry);
|
||||
|
||||
if (!spawnedTemplate)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
|
||||
LOG_ERROR("sql.sql", "TCSR: Creature template entry {} does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
|
||||
SpawnAssoc = nullptr;
|
||||
return;
|
||||
}
|
||||
@@ -548,7 +548,7 @@ public:
|
||||
SpawnedGUID = summoned->GetGUID();
|
||||
else
|
||||
{
|
||||
LOG_ERROR("sql.sql", "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
|
||||
LOG_ERROR("sql.sql", "TCSR: npc_air_force_bots: wasn't able to spawn Creature {}", SpawnAssoc->spawnedCreatureEntry);
|
||||
SpawnAssoc = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user