More log migrations to fmt / log aliases

This commit is contained in:
Akkadius
2019-09-02 02:33:02 -05:00
parent 2b1950d2e2
commit 2970afff67
18 changed files with 93 additions and 96 deletions
+1 -1
View File
@@ -864,7 +864,7 @@ Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, J
response["status"] = "Category doesn't exist";
Log(Logs::General, Logs::Status, "Logging category is %i and level is %i",
LogInfo("Logging category is [{}] and level is [{}]",
logging_category,
logging_level
);
+8 -8
View File
@@ -1088,14 +1088,14 @@ private:
}
static void status_report() {
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to %i.", RuleI(Bots, CommandSpellRank));
LogCommands("load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to [{}]", RuleI(Bots, CommandSpellRank));
if (bot_command_spells.empty()) {
LogError("load_bot_command_spells() - 'bot_command_spells' is empty");
return;
}
for (int i = BCEnum::SpellTypeFirst; i <= BCEnum::SpellTypeLast; ++i)
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - '%s' returned %u spell entries.",
LogCommands("load_bot_command_spells(): - [{}] returned [{}] spell entries",
BCEnum::SpellTypeEnumToString(static_cast<BCEnum::SpType>(i)).c_str(), bot_command_spells[static_cast<BCEnum::SpType>(i)].size());
}
@@ -1431,12 +1431,12 @@ int bot_command_init(void)
auto bot_command_settings_iter = bot_command_settings.find(working_bcl_iter.first);
if (bot_command_settings_iter == bot_command_settings.end()) {
if (working_bcl_iter.second->access == 0)
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Bot Command '%s' defaulting to access level 0!", working_bcl_iter.first.c_str());
LogCommands("bot_command_init(): Warning: Bot Command [{}] defaulting to access level 0!", working_bcl_iter.first.c_str());
continue;
}
working_bcl_iter.second->access = bot_command_settings_iter->second.first;
Log(Logs::General, Logs::Commands, "bot_command_init(): - Bot Command '%s' set to access level %d.", working_bcl_iter.first.c_str(), bot_command_settings_iter->second.first);
LogCommands("bot_command_init(): - Bot Command [{}] set to access level [{}]", working_bcl_iter.first.c_str(), bot_command_settings_iter->second.first);
if (bot_command_settings_iter->second.second.empty())
continue;
@@ -1444,14 +1444,14 @@ int bot_command_init(void)
if (alias_iter.empty())
continue;
if (bot_command_list.find(alias_iter) != bot_command_list.end()) {
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Alias '%s' already exists as a bot command - skipping!", alias_iter.c_str());
LogCommands("bot_command_init(): Warning: Alias [{}] already exists as a bot command - skipping!", alias_iter.c_str());
continue;
}
bot_command_list[alias_iter] = working_bcl_iter.second;
bot_command_aliases[alias_iter] = working_bcl_iter.first;
Log(Logs::General, Logs::Commands, "bot_command_init(): - Alias '%s' added to bot command '%s'.", alias_iter.c_str(), bot_command_aliases[alias_iter].c_str());
LogCommands("bot_command_init(): - Alias [{}] added to bot command [{}]", alias_iter.c_str(), bot_command_aliases[alias_iter].c_str());
}
}
@@ -1566,7 +1566,7 @@ int bot_command_real_dispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log(Logs::General, Logs::Commands, "%s (%s) used bot command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
LogCommands("[{}] ([{}]) used bot command: [{}] (target=[{}])", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
@@ -4254,7 +4254,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
}
if (!my_bot->GetBotID()) {
c->Message(m_unknown, "An unknown error has occured - BotName: %s, BotID: %u", my_bot->GetCleanName(), my_bot->GetBotID());
Log(Logs::General, Logs::Commands, "bot_command_clone(): - Error: Active bot reported invalid ID (BotName: %s, BotID: %u, OwnerName: %s, OwnerID: %u, AcctName: %s, AcctID: %u)",
LogCommands("bot_command_clone(): - Error: Active bot reported invalid ID (BotName: [{}], BotID: [{}], OwnerName: [{}], OwnerID: [{}], AcctName: [{}], AcctID: [{}])",
my_bot->GetCleanName(), my_bot->GetBotID(), c->GetCleanName(), c->CharacterID(), c->AccountName(), c->AccountID());
return;
}
+1 -1
View File
@@ -2558,7 +2558,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skil
Save();
Log(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
LogInfo("Reset [{}]'s caster specialization skills to 1"
"Too many specializations skills were above 50.", GetCleanName());
}
+4 -4
View File
@@ -2967,7 +2967,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
EQEmu::ItemInstance *itemOneToPush = nullptr, *itemTwoToPush = nullptr;
//Log(Logs::DebugLevel::Moderate, Logs::Debug, "cslot: %i aslot: %i cidx: %i aidx: %i act: %i dest: %i",
//Log(Logs::DebugLevel::Moderate, Logs::Debug, "cslot: [{}] aslot: [{}] cidx: [{}] aidx: [{}] act: [{}] dest: [{}]",
// in_augment->container_slot, in_augment->augment_slot, in_augment->container_index, in_augment->augment_index, in_augment->augment_action, in_augment->dest_inst_id);
EQEmu::ItemInstance *tobe_auged = nullptr, *old_aug = nullptr, *new_aug = nullptr, *aug = nullptr, *solvent = nullptr;
@@ -4477,7 +4477,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
is_client_moving = (ppu->y_pos == m_Position.y && ppu->x_pos == m_Position.x) ? false : true;
if (is_client_moving) {
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is moving - scan timer is: %u",
LogInfo("ClientUpdate: Client is moving - scan timer is: [{}]",
client_scan_npc_aggro_timer.GetDuration());
if (client_scan_npc_aggro_timer.GetDuration() > 1000) {
client_scan_npc_aggro_timer.Disable();
@@ -4485,7 +4485,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
}
}
else {
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is NOT moving - scan timer is: %u",
LogInfo("ClientUpdate: Client is NOT moving - scan timer is: [{}]",
client_scan_npc_aggro_timer.GetDuration());
if (client_scan_npc_aggro_timer.GetDuration() < 1000) {
client_scan_npc_aggro_timer.Disable();
@@ -4547,7 +4547,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
/* Visual Debugging */
if (RuleB(Character, OPClientUpdateVisualDebug)) {
Log(Logs::General, Logs::Debug, "ClientUpdate: ppu x: %f y: %f z: %f h: %u", ppu->x_pos, ppu->y_pos, ppu->z_pos,
LogDebug("ClientUpdate: ppu x: [{}] y: [{}] z: [{}] h: [{}]", ppu->x_pos, ppu->y_pos, ppu->z_pos,
ppu->heading);
this->SendAppearanceEffect(78, 0, 0, 0, 0);
this->SendAppearanceEffect(41, 0, 0, 0, 0);
+8 -8
View File
@@ -458,12 +458,12 @@ int command_init(void)
auto iter_cs = command_settings.find(iter_cl->first);
if (iter_cs == command_settings.end()) {
if (iter_cl->second->access == 0)
Log(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
LogCommands("command_init(): Warning: Command [{}] defaulting to access level 0!", iter_cl->first.c_str());
continue;
}
iter_cl->second->access = iter_cs->second.first;
Log(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", iter_cl->first.c_str(), iter_cs->second.first);
LogCommands("command_init(): - Command [{}] set to access level [{}]", iter_cl->first.c_str(), iter_cs->second.first);
if (iter_cs->second.second.empty())
continue;
@@ -472,14 +472,14 @@ int command_init(void)
if (iter_aka->empty())
continue;
if (commandlist.find(*iter_aka) != commandlist.end()) {
Log(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
LogCommands("command_init(): Warning: Alias [{}] already exists as a command - skipping!", iter_aka->c_str());
continue;
}
commandlist[*iter_aka] = iter_cl->second;
commandaliases[*iter_aka] = iter_cl->first;
Log(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
LogCommands("command_init(): - Alias [{}] added to command [{}]", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
}
}
@@ -587,7 +587,7 @@ int command_realdispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
LogCommands("[{}] ([{}]) used command: [{}] (target=[{}])", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
@@ -8519,7 +8519,7 @@ void command_ucs(Client *c, const Seperator *sep)
if (!c)
return;
Log(Logs::Detail, Logs::UCSServer, "Character %s attempting ucs reconnect while ucs server is %savailable",
LogInfo("Character [{}] attempting ucs reconnect while ucs server is [{}] available",
c->GetName(), (zone->IsUCSServerAvailable() ? "" : "un"));
if (zone->IsUCSServerAvailable()) {
@@ -12210,7 +12210,7 @@ void command_logtest(Client *c, const Seperator *sep){
uint32 i = 0;
t = std::clock();
for (i = 0; i < atoi(sep->arg[1]); i++){
Log(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
LogDebug("[[{}]] Test #2 Took [{}] seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
}
@@ -12308,7 +12308,7 @@ void command_mysqltest(Client *c, const Seperator *sep)
auto results = database.QueryDatabase(query);
}
}
Log(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
LogDebug("MySQL Test Took [{}] seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
void command_resetaa_timer(Client *c, const Seperator *sep) {
+5 -5
View File
@@ -140,12 +140,12 @@ void Embperl::DoInit() {
catch(const char *err)
{
//remember... lasterr() is no good if we crap out here, in construction
Log(Logs::General, Logs::Quests, "perl error: %s", err);
LogQuests("perl error: [{}]", err);
throw "failed to install eval_file hook";
}
#ifdef EMBPERL_IO_CAPTURE
Log(Logs::General, Logs::Quests, "Tying perl output to eqemu logs");
LogQuests("Tying perl output to eqemu logs");
//make a tieable class to capture IO and pass it into EQEMuLog
eval_pv(
"package EQEmuIO; "
@@ -170,7 +170,7 @@ void Embperl::DoInit() {
,FALSE
);
Log(Logs::General, Logs::Quests, "Loading perlemb plugins.");
LogQuests("Loading perlemb plugins");
try
{
std::string perl_command;
@@ -179,7 +179,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
LogQuests("Warning - [{}]: [{}]", Config->PluginPlFile.c_str(), err);
}
try
{
@@ -197,7 +197,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log(Logs::General, Logs::Quests, "Perl warning: %s", err);
LogQuests("Perl warning: [{}]", err);
}
#endif //EMBPERL_PLUGIN
in_use = false;
+1 -1
View File
@@ -258,7 +258,7 @@ void PathfinderWaypoint::Load(const std::string &filename) {
fread(&Head, sizeof(Head), 1, f);
Log(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld",
LogInfo("Path File Header: Version [{}], PathNodes [{}]",
(long)Head.version, (long)Head.PathNodeCount);
if (Head.version == 2)
+16 -16
View File
@@ -157,7 +157,7 @@ void QuestManager::echo(int colour, const char *str) {
void QuestManager::say(const char *str, Journal::Options &opts) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::say called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -558,7 +558,7 @@ void QuestManager::pausetimer(const char *timer_name) {
{
if (pcur->owner && pcur->owner == owner && pcur->name == timer_name)
{
Log(Logs::General, Logs::Quests, "Timer %s is already paused for %s. Returning...", timer_name, owner->GetName());
LogQuests("Timer [{}] is already paused for [{}]. Returning", timer_name, owner->GetName());
return;
}
++pcur;
@@ -580,7 +580,7 @@ void QuestManager::pausetimer(const char *timer_name) {
pt.name = timername;
pt.owner = owner;
pt.time = milliseconds;
Log(Logs::General, Logs::Quests, "Pausing timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Pausing timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
PTimerList.push_back(pt);
}
@@ -606,7 +606,7 @@ void QuestManager::resumetimer(const char *timer_name) {
if (milliseconds == 0)
{
Log(Logs::General, Logs::Quests, "Paused timer %s not found or has expired. Returning...", timer_name);
LogQuests("Paused timer [{}] not found or has expired. Returning", timer_name);
return;
}
@@ -617,14 +617,14 @@ void QuestManager::resumetimer(const char *timer_name) {
{
cur->Timer_.Enable();
cur->Timer_.Start(milliseconds, false);
Log(Logs::General, Logs::Quests, "Resuming timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Resuming timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
return;
}
++cur;
}
QTimerList.push_back(QuestTimer(milliseconds, owner, timer_name));
Log(Logs::General, Logs::Quests, "Creating a new timer and resuming %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Creating a new timer and resuming [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
}
@@ -649,7 +649,7 @@ bool QuestManager::ispausedtimer(const char *timer_name) {
void QuestManager::emote(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::emote called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -660,7 +660,7 @@ void QuestManager::emote(const char *str) {
void QuestManager::shout(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::shout called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -671,7 +671,7 @@ void QuestManager::shout(const char *str) {
void QuestManager::shout2(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -690,7 +690,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint
void QuestManager::depop(int npc_type) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC()) {
Log(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
LogQuests("QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
return;
}
else {
@@ -720,7 +720,7 @@ void QuestManager::depop(int npc_type) {
void QuestManager::depop_withtimer(int npc_type) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC()) {
Log(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
LogQuests("QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
return;
}
else {
@@ -747,7 +747,7 @@ void QuestManager::depopall(int npc_type) {
entity_list.DepopAll(npc_type);
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file.");
LogQuests("QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file");
}
}
@@ -756,7 +756,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) {
zone->Depop(StartSpawnTimer);
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file.");
LogQuests("QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file");
}
}
@@ -765,7 +765,7 @@ void QuestManager::repopzone() {
zone->Repop();
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file.");
LogQuests("QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file");
}
}
@@ -1825,7 +1825,7 @@ void QuestManager::showgrid(int grid) {
"ORDER BY `number`", grid, zone->GetZoneID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str());
LogQuests("Error loading grid [{}] for showgrid(): [{}]", grid, results.ErrorMessage().c_str());
return;
}
@@ -2978,7 +2978,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen
safe_delete(outapp);
}
else
Log(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str);
LogQuests("QuestManager::voicetell from [{}]. Client [{}] not found", owner->GetName(), str);
}
}
+2 -2
View File
@@ -4712,7 +4712,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return 0;
break;
default:
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d",
LogInfo("CalcFocusEffect: unknown limit spelltype [{}]",
focus_spell.base[i]);
}
break;
@@ -5090,7 +5090,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
// this spits up a lot of garbage when calculating spell focuses
// since they have all kinds of extra effects on them.
default:
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown effectid %d",
LogInfo("CalcFocusEffect: unknown effectid [{}]",
focus_spell.effectid[i]);
#endif
}
+7 -7
View File
@@ -14,30 +14,30 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
std::string file_path = Config->MapDir + "water/" + zone_name + std::string(".wtr");
Log(Logs::General, Logs::Debug, "Attempting to load water map with path %s", file_path.c_str());
LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
FILE *f = fopen(file_path.c_str(), "rb");
if(f) {
char magic[10];
uint32 version;
if(fread(magic, 10, 1, f) != 1) {
Log(Logs::General, Logs::Debug, "Failed to load water map, error reading magic string in header.");
LogDebug("Failed to load water map, error reading magic string in header");
fclose(f);
return nullptr;
}
if(strncmp(magic, "EQEMUWATER", 10)) {
Log(Logs::General, Logs::Debug, "Failed to load water map, bad magic string in header.");
LogDebug("Failed to load water map, bad magic string in header");
fclose(f);
return nullptr;
}
if(fread(&version, sizeof(version), 1, f) != 1) {
Log(Logs::General, Logs::Debug, "Failed to load water map, error reading version.");
LogDebug("Failed to load water map, error reading version");
fclose(f);
return nullptr;
}
Log(Logs::General, Logs::Debug, "Attempting to V%u load water map %s.", version, file_path.c_str());
LogDebug("Attempting to V[{}] load water map [{}]", version, file_path.c_str());
if(version == 1) {
auto wm = new WaterMapV1();
if(!wm->Load(f)) {
@@ -61,12 +61,12 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
fclose(f);
return wm;
} else {
Log(Logs::General, Logs::Debug, "Failed to load water map, unsupported version V%u.", version);
LogDebug("Failed to load water map, unsupported version V[{}]", version);
fclose(f);
return nullptr;
}
}
Log(Logs::General, Logs::Debug, "Failed to load water map, could not open file for reading %s.", file_path.c_str());
LogDebug("Failed to load water map, could not open file for reading [{}]", file_path.c_str());
return nullptr;
}
+2 -2
View File
@@ -204,7 +204,7 @@ bool ZoneDatabase::GetZoneCFG(
//not in the DB yet:
zone_data->gravity = atof(row[56]);
Log(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity);
LogDebug("Zone Gravity is [{}]", zone_data->gravity);
allow_mercs = true;
zone_data->FastRegenHP = atoi(row[57]);
@@ -2382,7 +2382,7 @@ const NPCType *ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
std::string where_condition = "";
if (bulk_load) {
Log(Logs::General, Logs::Debug, "Performing bulk NPC Types load");
LogDebug("Performing bulk NPC Types load");
where_condition = StringFormat(
"INNER JOIN spawnentry ON npc_types.id = spawnentry.npcID "
"INNER JOIN spawn2 ON spawnentry.spawngroupID = spawn2.spawngroupID "