Simplify error logging

This commit is contained in:
Akkadius
2019-09-01 22:05:44 -05:00
parent 98cbb7d781
commit 678c25e02c
44 changed files with 532 additions and 486 deletions
+8 -8
View File
@@ -76,12 +76,12 @@ Entity::~Entity()
Client *Entity::CastToClient()
{
if (this == 0x00) {
Log(Logs::General, Logs::Error, "CastToClient error (nullptr)");
LogError("CastToClient error (nullptr)");
return 0;
}
#ifdef _EQDEBUG
if (!IsClient()) {
Log(Logs::General, Logs::Error, "CastToClient error (not client)");
LogError("CastToClient error (not client)");
return 0;
}
#endif
@@ -93,7 +93,7 @@ NPC *Entity::CastToNPC()
{
#ifdef _EQDEBUG
if (!IsNPC()) {
Log(Logs::General, Logs::Error, "CastToNPC error (Not NPC)");
LogError("CastToNPC error (Not NPC)");
return 0;
}
#endif
@@ -377,7 +377,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
{
if (*it == nullptr)
{
Log(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
LogError("nullptr group, [{}]:[{}]", fname, fline);
}
}
}
@@ -540,12 +540,12 @@ void EntityList::MobProcess()
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
if(g) {
Log(Logs::General, Logs::Error, "About to delete a client still in a group.");
LogError("About to delete a client still in a group");
g->DelMember(mob);
}
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
if(r) {
Log(Logs::General, Logs::Error, "About to delete a client still in a raid.");
LogError("About to delete a client still in a raid");
r->MemberZoned(mob->CastToClient());
}
entity_list.RemoveClient(id);
@@ -817,7 +817,7 @@ void EntityList::CheckSpawnQueue()
auto it = npc_list.find(ns->spawn.spawnId);
if (it == npc_list.end()) {
// We must of despawned, hope that's the reason!
Log(Logs::General, Logs::Error, "Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId '%u'", ns->spawn.spawnId);
LogError("Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId [{}]", ns->spawn.spawnId);
}
else {
NPC *pnpc = it->second;
@@ -2877,7 +2877,7 @@ char *EntityList::MakeNameUnique(char *name)
return name;
}
}
Log(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
LogError("Fatal error in EntityList::MakeNameUnique: Unable to find unique name for [{}]", name);
char tmp[64] = "!";
strn0cpy(&tmp[1], name, sizeof(tmp) - 1);
strcpy(name, tmp);