Renamed DoLog to Out as the aggregate logging function for simplicity of use and shortened syntax of Log.Out

This commit is contained in:
Akkadius
2015-01-18 02:00:15 -06:00
parent 1c048cb1d1
commit c025765283
119 changed files with 2653 additions and 2653 deletions
+54 -54
View File
@@ -148,28 +148,28 @@ int main(int argc, char** argv) {
worldserver.SetLauncherName("NONE");
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration..");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration..");
if (!ZoneConfig::LoadConfig()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed.");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed.");
return 1;
}
const ZoneConfig *Config=ZoneConfig::get();
if(!load_log_settings(Config->LogSettingsFile.c_str()))
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
else
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
worldserver.SetPassword(Config->SharedKey.c_str());
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL...");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection.");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection.");
return 1;
}
@@ -186,121 +186,121 @@ int main(int argc, char** argv) {
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
/*
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler");
return 1;
}
#endif
const char *log_ini_file = "./log.ini";
if(!load_log_settings(log_ini_file))
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file);
else
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes");
MapOpcodes();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables");
database.LoadVariables();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names");
database.LoadZoneNames();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items");
if (!database.LoadItems()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!");
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on...");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on...");
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists");
if (!database.LoadNPCFactionLists()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!");
CheckEQEMuErrorAndPause();
return 1;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables");
if (!database.LoadLoot()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!");
CheckEQEMuErrorAndPause();
return 1;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps");
if (!database.LoadSkillCaps()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!");
CheckEQEMuErrorAndPause();
return 1;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells");
EQEmu::MemoryMappedFile *mmf = nullptr;
LoadSpells(&mmf);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data");
if (!database.LoadBaseData()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!");
CheckEQEMuErrorAndPause();
return 1;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds");
guild_mgr.LoadGuilds();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions");
database.LoadFactionData();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles");
title_manager.LoadTitles();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects");
database.LoadAAEffects();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes");
database.LoadTributes();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands");
int retval=command_init();
if(retval<0)
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED");
else
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval);
//rules:
{
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp);
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules");
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp);
}
}
}
if(RuleB(TaskSystem, EnableTaskSystem)) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks");
taskmanager = new TaskManager;
taskmanager->LoadTasks();
}
@@ -317,11 +317,11 @@ int main(int argc, char** argv) {
#endif
//now we have our parser, load the quests
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests");
parse->ReloadQuests();
if (!worldserver.Connect()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()");
}
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
@@ -332,9 +332,9 @@ int main(int argc, char** argv) {
#endif
#endif
if (!strlen(zone_name) || !strcmp(zone_name,".")) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode");
} else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup");
zone = 0;
}
@@ -343,7 +343,7 @@ int main(int argc, char** argv) {
RegisterAllPatches(stream_identifier);
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self());
#endif
Timer quest_timers(100);
@@ -365,13 +365,13 @@ int main(int argc, char** argv) {
worldserver.Process();
if (!eqsf.IsOpen() && Config->ZonePort!=0) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort);
// log_sys.CloseZoneLogs();
// log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
if (!eqsf.Open(Config->ZonePort)) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort);
ZoneConfig::SetZonePort(0);
worldserver.Disconnect();
worldwasconnected = false;
@@ -385,7 +385,7 @@ int main(int argc, char** argv) {
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqss->GetRemoteIP();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
stream_identifier.AddStream(eqss); //takes the stream
}
@@ -397,7 +397,7 @@ int main(int argc, char** argv) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
entity_list.AddClient(client);
}
@@ -522,13 +522,13 @@ int main(int argc, char** argv) {
command_deinit();
safe_delete(parse);
CheckEQEMuErrorAndPause();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete.");
return 0;
}
void CatchSignal(int sig_num) {
#ifdef _WINDOWS
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num);
#endif
RunLoops = false;
}
@@ -539,7 +539,7 @@ void Shutdown()
RunLoops = false;
worldserver.Disconnect();
// safe_delete(worldserver);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down...");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down...");
}
uint32 NetConnection::GetIP()
@@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) {
spells = reinterpret_cast<SPDat_Spell_Struct*>((*mmf)->Get());
mutex.Unlock();
} catch(std::exception &ex) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what());
return;
}