mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 08:16:08 +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:
@@ -109,7 +109,7 @@ void Channel::UpdateChannelInDB() const
|
||||
stmt->setUInt32(2, _channelDBId);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
LOG_DEBUG("chat.system", "Channel(%s) updated in database", _name.c_str());
|
||||
LOG_DEBUG("chat.system", "Channel({}) updated in database", _name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,9 +522,9 @@ void Channel::UnBan(Player const* player, std::string const& badname)
|
||||
}
|
||||
|
||||
if (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)
|
||||
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [%s, account: %u] unbanned %s [%s])",
|
||||
GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(), player->GetSession()->GetAccountId(),
|
||||
badname.c_str(), victim.ToString().c_str());
|
||||
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban {} {} (Moderator {} [{}, account: {}] unbanned {} [{}])",
|
||||
GetName(), badname, player->GetName(), player->GetGUID().ToString(), player->GetSession()->GetAccountId(),
|
||||
badname, victim.ToString());
|
||||
|
||||
bannedStore.erase(victim);
|
||||
RemoveChannelBanFromDB(victim);
|
||||
@@ -710,7 +710,7 @@ void Channel::List(Player const* player)
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("chat.system", "SMSG_CHANNEL_LIST %s Channel: %s", player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
|
||||
LOG_DEBUG("chat.system", "SMSG_CHANNEL_LIST {} Channel: {}", player->GetSession()->GetPlayerInfo(), GetName());
|
||||
WorldPacket data(SMSG_CHANNEL_LIST, 1 + (GetName().size() + 1) + 1 + 4 + playersStore.size() * (8 + 1));
|
||||
data << uint8(1); // channel type?
|
||||
data << GetName(); // channel name
|
||||
|
||||
@@ -73,7 +73,7 @@ void ChannelMgr::LoadChannels()
|
||||
std::wstring channelWName;
|
||||
if (!Utf8toWStr(channelName, channelWName))
|
||||
{
|
||||
LOG_ERROR("server.loading", "Failed to load channel '%s' from database - invalid utf8 sequence? Deleted.", channelName.c_str());
|
||||
LOG_ERROR("server.loading", "Failed to load channel '{}' from database - invalid utf8 sequence? Deleted.", channelName);
|
||||
toDelete.push_back({ channelName, team });
|
||||
continue;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void ChannelMgr::LoadChannels()
|
||||
ChannelMgr* mgr = forTeam(team);
|
||||
if (!mgr)
|
||||
{
|
||||
LOG_ERROR("server.loading", "Failed to load custom chat channel '%s' from database - invalid team %u. Deleted.", channelName.c_str(), team);
|
||||
LOG_ERROR("server.loading", "Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", channelName, team);
|
||||
toDelete.push_back({ channelName, team });
|
||||
continue;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void ChannelMgr::LoadChannels()
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u channels in %ums", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} channels in {}ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ void ChannelMgr::LoadChannelRights()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} Channel Rights in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuil
|
||||
else
|
||||
{
|
||||
std::vector<std::string_view> const tokens = Acore::Tokenize(builder._name, COMMAND_DELIMITER, false);
|
||||
ASSERT(!tokens.empty(), "Invalid command name '" STRING_VIEW_FMT "'.", STRING_VIEW_FMT_ARG(builder._name));
|
||||
ASSERT(!tokens.empty(), "Invalid command name '{}'.", builder._name);
|
||||
ChatSubCommandMap* subMap = ↦
|
||||
for (size_t i = 0, n = (tokens.size() - 1); i < n; ++i)
|
||||
subMap = &((*subMap)[tokens[i]]._subCommands);
|
||||
@@ -105,7 +105,7 @@ static ChatSubCommandMap COMMAND_MAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Table `command` contains data for non-existant command '" STRING_VIEW_FMT "'. Skipped.", STRING_VIEW_FMT_ARG(name));
|
||||
LOG_ERROR("sql.sql", "Table `command` contains data for non-existant command '{}'. Skipped.", name);
|
||||
cmd = nullptr;
|
||||
break;
|
||||
}
|
||||
@@ -116,19 +116,19 @@ static ChatSubCommandMap COMMAND_MAP;
|
||||
|
||||
if (cmd->_invoker && (cmd->_permission.RequiredLevel != secLevel))
|
||||
{
|
||||
LOG_WARN("sql.sql", "Table `command` has permission %u for '" STRING_VIEW_FMT "' which does not match the core (%u). Overriding.",
|
||||
secLevel, STRING_VIEW_FMT_ARG(name), cmd->_permission.RequiredLevel);
|
||||
LOG_WARN("sql.sql", "Table `command` has permission {} for '{}' which does not match the core ({}). Overriding.",
|
||||
secLevel, name, cmd->_permission.RequiredLevel);
|
||||
|
||||
cmd->_permission.RequiredLevel = secLevel;
|
||||
}
|
||||
|
||||
if (std::holds_alternative<std::string>(cmd->_help))
|
||||
LOG_ERROR("sql.sql", "Table `command` contains duplicate data for command '" STRING_VIEW_FMT "'. Skipped.", STRING_VIEW_FMT_ARG(name));
|
||||
LOG_ERROR("sql.sql", "Table `command` contains duplicate data for command '{}'. Skipped.", name);
|
||||
|
||||
if (std::holds_alternative<std::monostate>(cmd->_help))
|
||||
cmd->_help.emplace<std::string>(help);
|
||||
else
|
||||
LOG_ERROR("sql.sql", "Table `command` contains legacy help text for command '" STRING_VIEW_FMT "', which uses `trinity_string`. Skipped.", STRING_VIEW_FMT_ARG(name));
|
||||
LOG_ERROR("sql.sql", "Table `command` contains legacy help text for command '{}', which uses `trinity_string`. Skipped.", name);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ static ChatSubCommandMap COMMAND_MAP;
|
||||
void Acore::Impl::ChatCommands::ChatCommandNode::ResolveNames(std::string name)
|
||||
{
|
||||
if (_invoker && std::holds_alternative<std::monostate>(_help))
|
||||
LOG_WARN("sql.sql", "Table `command` is missing help text for command '" STRING_VIEW_FMT "'.", STRING_VIEW_FMT_ARG(name));
|
||||
LOG_WARN("sql.sql", "Table `command` is missing help text for command '{}'.", name);
|
||||
|
||||
_name = name;
|
||||
|
||||
@@ -449,13 +449,11 @@ namespace Acore::Impl::ChatCommands
|
||||
{
|
||||
if (prefix.empty())
|
||||
{
|
||||
return Acore::StringFormat(STRING_VIEW_FMT "%c" STRING_VIEW_FMT,
|
||||
STRING_VIEW_FMT_ARG(match), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(suffix));
|
||||
return Acore::StringFormatFmt("{}{}{}", match, COMMAND_DELIMITER, suffix);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Acore::StringFormat(STRING_VIEW_FMT "%c" STRING_VIEW_FMT "%c" STRING_VIEW_FMT,
|
||||
STRING_VIEW_FMT_ARG(prefix), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(match), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(suffix));
|
||||
return Acore::StringFormatFmt("{}{}{}{}{}", prefix, COMMAND_DELIMITER, match, COMMAND_DELIMITER, suffix);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -473,8 +471,7 @@ namespace Acore::Impl::ChatCommands
|
||||
path.assign(it1->first);
|
||||
else
|
||||
{
|
||||
path = Acore::StringFormat(STRING_VIEW_FMT "%c" STRING_VIEW_FMT,
|
||||
STRING_VIEW_FMT_ARG(path), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(it1->first));
|
||||
path = Acore::StringFormatFmt("{}{}{}", path, COMMAND_DELIMITER, it1->first);
|
||||
}
|
||||
cmd = &it1->second;
|
||||
map = &cmd->_subCommands;
|
||||
@@ -486,10 +483,7 @@ namespace Acore::Impl::ChatCommands
|
||||
{ /* there is some trailing text, leave it as is */
|
||||
if (cmd)
|
||||
{ /* if we matched a command at some point, auto-complete it */
|
||||
return {
|
||||
Acore::StringFormat(STRING_VIEW_FMT "%c" STRING_VIEW_FMT,
|
||||
STRING_VIEW_FMT_ARG(path), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(oldTail))
|
||||
};
|
||||
return { Acore::StringFormatFmt("{}{}{}", path, COMMAND_DELIMITER, oldTail) };
|
||||
}
|
||||
else
|
||||
return {};
|
||||
@@ -502,8 +496,7 @@ namespace Acore::Impl::ChatCommands
|
||||
return std::string(match);
|
||||
else
|
||||
{
|
||||
return Acore::StringFormat(STRING_VIEW_FMT "%c" STRING_VIEW_FMT,
|
||||
STRING_VIEW_FMT_ARG(prefix), COMMAND_DELIMITER, STRING_VIEW_FMT_ARG(match));
|
||||
return Acore::StringFormatFmt("{}{}{}", prefix, COMMAND_DELIMITER, match);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ namespace Acore::Impl::ChatCommands
|
||||
return result2;
|
||||
if (result1.HasErrorMessage() && result2.HasErrorMessage())
|
||||
{
|
||||
return Acore::StringFormat("%s \"%s\"\n%s \"%s\"",
|
||||
GetAcoreString(handler, LANG_CMDPARSER_EITHER), result2.GetErrorMessage().c_str(),
|
||||
GetAcoreString(handler, LANG_CMDPARSER_OR), result1.GetErrorMessage().c_str());
|
||||
return Acore::StringFormatFmt("{} \"{}\"\n{} \"{}\"",
|
||||
GetAcoreString(handler, LANG_CMDPARSER_EITHER), result2.GetErrorMessage(),
|
||||
GetAcoreString(handler, LANG_CMDPARSER_OR), result1.GetErrorMessage());
|
||||
}
|
||||
else if (result1.HasErrorMessage())
|
||||
return result1;
|
||||
|
||||
Reference in New Issue
Block a user