diff options
Diffstat (limited to 'src/server/worldserver/Master.cpp')
-rwxr-xr-x | src/server/worldserver/Master.cpp | 86 |
1 files changed, 40 insertions, 46 deletions
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 03b2859c514..48e07c727b4 100755 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -84,7 +84,7 @@ public: { if (!_delaytime) return; - sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); m_loops = 0; w_loops = 0; m_lastchange = 0; @@ -102,11 +102,11 @@ public: // possible freeze else if (getMSTimeDiff(w_lastchange, curtime) > _delaytime) { - sLog->outError("World Thread hangs, kicking out server!"); + sLog->outError(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!"); ASSERT(false); } } - sLog->outString("Anti-freeze thread exiting without problems."); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Anti-freeze thread exiting without problems."); } }; @@ -124,18 +124,18 @@ int Master::Run() BigNumber seed1; seed1.SetRand(16 * 8); - sLog->outString("%s (worldserver-daemon)", _FULLVERSION); - sLog->outString("<Ctrl-C> to stop.\n"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "<Ctrl-C> to stop.\n"); - sLog->outString(" ______ __"); - sLog->outString("/\\__ _\\ __ __/\\ \\__"); - sLog->outString("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); - sLog->outString(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); - sLog->outString(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); - sLog->outString(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); - sLog->outString(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); - sLog->outString(" C O R E /\\___/"); - sLog->outString("http://TrinityCore.org \\/__/\n"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " ______ __"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "/\\__ _\\ __ __/\\ \\__"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, " C O R E /\\___/"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n"); /// worldserver PID file creation std::string pidfile = ConfigMgr::GetStringDefault("PidFile", ""); @@ -144,11 +144,11 @@ int Master::Run() uint32 pid = CreatePIDFile(pidfile); if (!pid) { - sLog->outError("Cannot create PID file %s.\n", pidfile.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidfile.c_str()); return 1; } - sLog->outString("Daemon PID: %u\n", pid); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid); } ///- Start the databases @@ -161,13 +161,13 @@ int Master::Run() ///- Initialize the World sWorld->SetInitialWorldSettings(); - // Initialise the signal handlers + ///- Initialize the signal handlers WorldServerSignalHandler SignalINT, SignalTERM; #ifdef _WIN32 WorldServerSignalHandler SignalBREAK; #endif /* _WIN32 */ - // Register worldserver's signal handlers + ///- Register worldserver's signal handlers ACE_Sig_Handler Handler; Handler.register_handler(SIGINT, &SignalINT); Handler.register_handler(SIGTERM, &SignalTERM); @@ -210,17 +210,16 @@ int Master::Run() if (!curAff) { - sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff); + sLog->outError(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff); } else { if (SetProcessAffinityMask(hProcess, curAff)) - sLog->outString("Using processors (bitmask, hex): %x", curAff); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff); else - sLog->outError("Can't set used processors (hex): %x", curAff); + sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff); } } - sLog->outString(""); } bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false); @@ -229,10 +228,9 @@ int Master::Run() if (Prio) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - sLog->outString("worldserver process priority class set to HIGH"); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH"); else - sLog->outError("Can't set worldserver process priority class."); - sLog->outString(""); + sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class."); } } #endif @@ -250,7 +248,7 @@ int Master::Run() if (uint32 freeze_delay = ConfigMgr::GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable(); - fdr->SetDelayTime(freeze_delay*1000); + fdr->SetDelayTime(freeze_delay * 1000); ACE_Based::Thread freeze_thread(fdr); freeze_thread.setPriority(ACE_Based::Highest); } @@ -259,9 +257,9 @@ int Master::Run() uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD); std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0"); - if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str ()) == -1) + if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1) { - sLog->outError("Failed to start network"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Failed to start network"); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } @@ -269,7 +267,7 @@ int Master::Run() // set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); - sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION); // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master @@ -291,7 +289,7 @@ int Master::Run() _StopDB(); - sLog->outString("Halting process..."); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Halting process..."); if (cliThread) { @@ -356,21 +354,20 @@ bool Master::_StartDB() { MySQL::Library_Init(); - sLog->SetLogDB(false); std::string dbstring; uint8 async_threads, synch_threads; dbstring = ConfigMgr::GetStringDefault("WorldDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("World database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("WorldDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("World database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -379,7 +376,7 @@ bool Master::_StartDB() ///- Initialise the world database if (!WorldDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to world database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbstring.c_str()); return false; } @@ -387,14 +384,14 @@ bool Master::_StartDB() dbstring = ConfigMgr::GetStringDefault("CharacterDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Character database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("CharacterDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("Character database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -404,7 +401,7 @@ bool Master::_StartDB() ///- Initialise the Character database if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to Character database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbstring.c_str()); return false; } @@ -412,14 +409,14 @@ bool Master::_StartDB() dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { - sLog->outError("Login database not specified in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file"); return false; } async_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1); if (async_threads < 1 || async_threads > 32) { - sLog->outError("Login database: invalid number of worker threads specified. " + sLog->outError(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -428,7 +425,7 @@ bool Master::_StartDB() ///- Initialise the login database if (!LoginDatabase.Open(dbstring, async_threads, synch_threads)) { - sLog->outError("Cannot connect to login database %s", dbstring.c_str()); + sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbstring.c_str()); return false; } @@ -436,14 +433,11 @@ bool Master::_StartDB() realmID = ConfigMgr::GetIntDefault("RealmID", 0); if (!realmID) { - sLog->outError("Realm ID not defined in configuration file"); + sLog->outError(LOG_FILTER_WORLDSERVER, "Realm ID not defined in configuration file"); return false; } - sLog->outString("Realm running as realm ID %d", realmID); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Realm running as realm ID %d", realmID); - ///- Initialize the DB logging system - sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished. - sLog->SetLogDB(false); sLog->SetRealmID(realmID); ///- Clean the database before starting @@ -454,7 +448,7 @@ bool Master::_StartDB() sWorld->LoadDBVersion(); - sLog->outString("Using World DB: %s", sWorld->GetDBVersion()); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using World DB: %s", sWorld->GetDBVersion()); return true; } |