diff options
| author | Kargatum <dowlandtop@yandex.com> | 2022-01-27 22:44:41 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-27 16:44:41 +0100 |
| commit | 5969df4e303121cca77166df28aa0e9ff2f17e9f (patch) | |
| tree | af8b4ad44f17854fb0e8eeeb0d4eb387b0715bbf /src/server/scripts | |
| parent | 5228d293794bb1137a1f857ade784a39ee460bdd (diff) | |
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
Diffstat (limited to 'src/server/scripts')
18 files changed, 59 insertions, 59 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 307f6ad278..ce0a61c840 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -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: diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 994d379517..871e67bd26 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -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; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 4cad8ed71b..6f255b5925 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -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; diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 2754374823..eaf9323121 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -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(); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index f1c0c5d042..d920d29129 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -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(); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index a7922c6ca9..f0cbf66143 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -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; } diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 53ab969717..5b9d25f879 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -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(); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index d4bd921f92..f2c45c661a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -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) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index a7e161d719..2ac027b85b 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -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; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index bb288c19db..d0b1828cc0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -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; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 390d1f410a..b5035fa987 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -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) diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 924ae32cda..5aeab3c446 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -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; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 1710ce8c68..fe5ef1f43e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -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) { diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 26285e7e07..ee6d3367a5 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -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; } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 3d03fc6d40..a744147564 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -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; } } diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index d3333c8bca..186398009a 100644 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -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); } } }; diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index ea30b53610..f984bcfcc4 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -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; } } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 0a0da2de2a..7df7d5c79c 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -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; } |
