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
+20 -15
View File
@@ -1177,10 +1177,15 @@ bool Group::LearnMembers() {
if (!results.Success())
return false;
if (results.RowCount() == 0) {
Log(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
return false;
}
if (results.RowCount() == 0) {
LogError(
"Error getting group members for group [{}]: [{}]",
(unsigned long) GetID(),
results.ErrorMessage().c_str()
);
return false;
}
int memberIndex = 0;
for(auto row = results.begin(); row != results.end(); ++row) {
@@ -1566,7 +1571,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
MainTankName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main tank: [{}]\n", results.ErrorMessage().c_str());
}
}
@@ -1612,7 +1617,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
MainAssistName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main assist: [{}]\n", results.ErrorMessage().c_str());
}
}
@@ -1659,7 +1664,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
PullerName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main puller: [{}]\n", results.ErrorMessage().c_str());
}
@@ -1810,7 +1815,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main tank: [{}]\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1859,7 +1864,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main assist: [{}]\n", results.ErrorMessage().c_str());
if(!toggle)
{
@@ -1887,7 +1892,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main puller: [{}]\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1970,7 +1975,7 @@ void Group::SetGroupMentor(int percent, char *name)
mentoree_name.c_str(), mentor_percent, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group mentor: [{}]\n", results.ErrorMessage().c_str());
}
void Group::ClearGroupMentor()
@@ -1981,7 +1986,7 @@ void Group::ClearGroupMentor()
std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group mentor: [{}]\n", results.ErrorMessage().c_str());
}
void Group::NotifyAssistTarget(Client *c)
@@ -2051,7 +2056,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
NewNPCMarkerName, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group mark npc: [{}]\n", results.ErrorMessage().c_str());
}
void Group::NotifyMarkNPC(Client *c)
@@ -2132,7 +2137,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group marknpc: [{}]\n", results.ErrorMessage().c_str());
}
@@ -2149,7 +2154,7 @@ void Group::SaveGroupLeaderAA()
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
}