Rename LogDebugType to DebugCategory

This commit is contained in:
Akkadius
2015-01-16 03:09:02 -06:00
parent 5a3b40c503
commit 132fbbb0c6
70 changed files with 1039 additions and 1039 deletions
+9 -9
View File
@@ -47,13 +47,13 @@ int main(int argc, char *argv[]) {
launcher_name = argv[1];
}
if(launcher_name.length() < 1) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program.");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program.");
return 1;
}
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration..");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration..");
if (!EQEmuConfig::LoadConfig()) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed.");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed.");
return 1;
}
const EQEmuConfig *Config = EQEmuConfig::get();
@@ -62,16 +62,16 @@ int main(int argc, char *argv[]) {
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler");
return 1;
}
@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) {
std::map<std::string, ZoneLaunch *> zones;
WorldServer world(zones, launcher_name.c_str(), Config);
if (!world.Connect()) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry.");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry.");
}
std::map<std::string, ZoneLaunch *>::iterator zone, zend;
@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop...");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop...");
// zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1");
@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) {
void CatchSignal(int sig_num) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num);
RunLoops = false;
}
+9 -9
View File
@@ -74,14 +74,14 @@ void WorldServer::Process() {
break;
}
case ServerOP_ZAAuthFailed: {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect");
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect");
pTryReconnect = false;
Disconnect();
break;
}
case ServerOP_LauncherZoneRequest: {
if(pack->size != sizeof(LauncherZoneRequest)) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size);
break;
}
const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer;
@@ -90,9 +90,9 @@ void WorldServer::Process() {
switch(ZoneRequestCommands(lzr->command)) {
case ZR_Start: {
if(m_zones.find(lzr->short_name) != m_zones.end()) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name);
} else {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name);
ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config);
m_zones[lzr->short_name] = l;
}
@@ -101,9 +101,9 @@ void WorldServer::Process() {
case ZR_Restart: {
std::map<std::string, ZoneLaunch *>::iterator res = m_zones.find(lzr->short_name);
if(res == m_zones.end()) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name);
} else {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name);
res->second->Restart();
}
break;
@@ -111,9 +111,9 @@ void WorldServer::Process() {
case ZR_Stop: {
std::map<std::string, ZoneLaunch *>::iterator res = m_zones.find(lzr->short_name);
if(res == m_zones.end()) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name);
} else {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name);
res->second->Stop();
}
break;
@@ -127,7 +127,7 @@ void WorldServer::Process() {
}
default: {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size);
break;
}
}
+23 -23
View File
@@ -72,7 +72,7 @@ void ZoneLaunch::Start() {
//spec is consumed, even on failure
m_ref = ProcLauncher::get()->Launch(spec);
if(m_ref == ProcLauncher::ProcError) {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName);
m_timer.Start(m_config->RestartWait);
return;
}
@@ -84,17 +84,17 @@ void ZoneLaunch::Start() {
SendStatus();
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str());
}
void ZoneLaunch::Restart() {
switch(m_state) {
case StateRestartPending:
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str());
break;
case StateStartPending:
//we havent started yet, do nothing
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str());
break;
case StateStarted:
//process is running along, kill it off..
@@ -102,20 +102,20 @@ void ZoneLaunch::Restart() {
break; //we have no proc ref... cannot stop..
if(!ProcLauncher::get()->Terminate(m_ref, true)) {
//failed to terminate the process, its not likely that it will work if we try again, so give up.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str());
m_state = StateStopped;
break;
}
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str());
m_timer.Start(m_config->TerminateWait);
m_state = StateRestartPending;
break;
case StateStopPending:
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str());
break;
case StateStopped:
//process is already stopped... nothing to do..
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str());
break;
}
}
@@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) {
switch(m_state) {
case StateStartPending:
//we havent started yet, transition directly to stopped.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str());
m_state = StateStopped;
break;
case StateStarted:
@@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) {
break; //we have no proc ref... cannot stop..
if(!ProcLauncher::get()->Terminate(m_ref, graceful)) {
//failed to terminate the process, its not likely that it will work if we try again, so give up.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str());
m_state = StateStopped;
break;
}
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str());
m_timer.Start(m_config->TerminateWait);
m_state = StateStopPending;
break;
case StateStopped:
//process is already stopped... nothing to do..
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str());
break;
}
}
@@ -164,17 +164,17 @@ bool ZoneLaunch::Process() {
m_timer.Disable();
//actually start up the program
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str());
Start();
//now update the shared timer to reflect the proper start interval.
if(s_running == 1) {
//we are the first zone started. wait that interval.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait);
s_startTimer.Start(m_config->InitialBootWait);
} else {
//just some follow on zone, use that interval.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval);
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval);
s_startTimer.Start(m_config->ZoneBootInterval);
}
@@ -187,7 +187,7 @@ bool ZoneLaunch::Process() {
//waiting for notification that our child has died..
if(m_timer.Check()) {
//we have timed out, try to kill the child again
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str());
Restart();
}
break;
@@ -197,12 +197,12 @@ bool ZoneLaunch::Process() {
//we have timed out, try to kill the child again
m_killFails++;
if(m_killFails > 5) { //should get this number from somewhere..
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str());
m_state = StateStopped;
s_running--;
SendStatus();
} else {
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str());
Stop(false);
}
}
@@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche
switch(m_state) {
case StateStartPending:
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str());
m_state = StateStartPending;
m_timer.Start(m_config->RestartWait);
break;
case StateStarted:
//something happened to our happy process...
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str());
m_state = StateStartPending;
m_timer.Start(m_config->RestartWait);
break;
case StateRestartPending:
//it finally died, start it on up again
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str());
m_state = StateStartPending;
break;
case StateStopPending:
//it finally died, transition to close.
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str());
m_state = StateStopped;
break;
case StateStopped:
//we already thought it was stopped... dont care...
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str());
logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str());
break;
}