Core/Logging: Refactored appender creation to allow using logging without mysql dependency in tools (future task)

This commit is contained in:
Shauren
2015-08-16 00:12:18 +02:00
parent 21e0880fba
commit d5cf594bfe
12 changed files with 123 additions and 97 deletions

View File

@@ -45,6 +45,7 @@
#include "BattlenetServerManager.h"
#include "Realm/Realm.h"
#include "DatabaseLoader.h"
#include "AppenderDB.h"
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
#include <boost/asio/io_service.hpp>
@@ -125,11 +126,9 @@ extern int main(int argc, char** argv)
return 1;
}
if (sConfigMgr->GetBoolDefault("Log.Async.Enable", false))
{
// If logs are supposed to be handled async then we need to pass the io_service into the Log singleton
Log::instance(&_ioService);
}
sLog->RegisterAppender<AppenderDB>();
// If logs are supposed to be handled async then we need to pass the io_service into the Log singleton
sLog->Initialize(sConfigMgr->GetBoolDefault("Log.Async.Enable", false) ? &_ioService : nullptr);
TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION);
TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop.\n");