diff options
author | XTZGZoReX <none@none> | 2009-03-19 21:13:52 +0100 |
---|---|---|
committer | XTZGZoReX <none@none> | 2009-03-19 21:13:52 +0100 |
commit | 9fe43fa9c0bd21f6c203072f19a77a570680ecab (patch) | |
tree | 5592cf3a9b39a04e7e81295408625713a6fdd2bd /src/realmd/Main.cpp | |
parent | fd2f768dfd7c877880942477a7d1b1645f5bfab9 (diff) |
* Implementing database logging:
** LogTime and LogColors config options removed due to incompatibility.
** Old file logging still available.
** Totally redone the Log class.
** Config options added: EnableLogDB, DBLogLevel, LogDB.Char, LogDB.RA, LogDB.GM -- remember to update config file.
** SQL updates attached.
--HG--
branch : trunk
Diffstat (limited to 'src/realmd/Main.cpp')
-rw-r--r-- | src/realmd/Main.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 898a87af2d7..bd318779f83 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -182,6 +182,15 @@ extern int main(int argc, char **argv) if(!StartDB()) return 1; + ///- Initialize the log database + if(sConfig.GetBoolDefault("EnableLogDB", false)) + { + // everything successful - set var to enable DB logging once startup finished. + sLog.SetLogDBLater(true); + // ensure we've set realm to 0 (realmd realmid) + sLog.SetRealmID(0); + } + ///- Get the list of realms for the server m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); if (m_realmList.size() == 0) @@ -234,7 +243,7 @@ extern int main(int argc, char **argv) sLog.outError("Can't set used processors (hex): %x", curAff); } } - sLog.outString(); + sLog.outString(""); } bool Prio = sConfig.GetBoolDefault("ProcessPriority", false); @@ -245,7 +254,7 @@ extern int main(int argc, char **argv) sLog.outString("TrinityRealm process priority class set to HIGH"); else sLog.outError("ERROR: Can't set realmd process priority class."); - sLog.outString(); + sLog.outString(""); } } #endif @@ -254,6 +263,15 @@ extern int main(int argc, char **argv) uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000)); uint32 loopCounter = 0; + // possibly enable db logging; avoid massive startup spam by doing it here. + if (sLog.GetLogDBLater()) + { + sLog.outString("Enabling database logging..."); + sLog.SetLogDBLater(false); + // login db needs thread for logging + sLog.SetLogDB(true); + } + ///- Wait for termination signal while (!stopEvent) { @@ -273,6 +291,7 @@ extern int main(int argc, char **argv) } ///- Wait for the delay thread to exit + LoginDatabase.ThreadEnd(); LoginDatabase.HaltDelayThread(); ///- Remove signal handling before leaving @@ -317,6 +336,7 @@ bool StartDB() sLog.outError("Cannot connect to database"); return false; } + LoginDatabase.ThreadStart(); return true; } |