Replace LogFile->write(EQEmuLog::Error, with logger.logevents(EQEmuLogSys::Error

This commit is contained in:
Akkadius
2015-01-10 15:44:35 -06:00
parent dadae1a71f
commit 6844645dfb
40 changed files with 415 additions and 409 deletions
+23 -23
View File
@@ -116,7 +116,7 @@ void NPC::ResumeWandering()
}
else
{
LogFile->write(EQEmuLog::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
logger.Log(EQEmuLogSys::Error,"NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
return;
}
@@ -131,7 +131,7 @@ void NPC::ResumeWandering()
}
else
{
LogFile->write(EQEmuLog::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime)
AIwalking_timer->Start(pausetime*1000); // set the timer
}
} else {
LogFile->write(EQEmuLog::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID());
logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) {
std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str());
return;
}
@@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) {
"ORDER BY `number`", grid, zone->GetZoneID());
results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str());
return;
}
@@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
@@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
@@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
"WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
zone->GetShortName(), (int)x, (int)y);
auto results = QueryDatabase(query);
if(!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE);
results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
results = QueryDatabase(query);
if (!results.Success())
{
LogFile->write(EQEmuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type
"VALUES (%i, %i, %i, %i)", id, zoneid, type, type2);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type
std::string query = StringFormat("DELETE FROM grid where id=%i", id);
auto results = QueryDatabase(query);
if (!results.Success())
LogFile->write(EQEmuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
else if(client)
client->LogSQL(query.c_str());
query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id);
results = QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEmuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
else if(client)
client->LogSQL(query.c_str());
@@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos
gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num
grid_num, zoneid, wp_num);
auto results = QueryDatabase(query);
if(!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos,
auto results = QueryDatabase(query);
if (!results.Success()) {
// Query error
LogFile->write(EQEmuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
@@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos,
grid_num, zoneid, type1, type2);
results = QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEmuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
else if(client)
client->LogSQL(query.c_str());
query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id);
results = QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEmuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
else if(client)
client->LogSQL(query.c_str());
}
@@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos,
results = QueryDatabase(query);
if(!results.Success()) { // Query error
LogFile->write(EQEmuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
@@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos,
grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading);
results = QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEmuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
else if(client)
client->LogSQL(query.c_str());
@@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
@@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
"WHERE zoneid = %i AND gridid = %i", zoneid, gridid);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEmuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
logger.Log(EQEmuLogSys::Error,"Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return 0;
}