summaryrefslogtreecommitdiffstats
path: root/src/Core/LogManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core/LogManager.cpp')
-rw-r--r--src/Core/LogManager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Core/LogManager.cpp b/src/Core/LogManager.cpp
index 91149f9..28b1f6f 100644
--- a/src/Core/LogManager.cpp
+++ b/src/Core/LogManager.cpp
@@ -18,16 +18,15 @@
*/
#include "LogManager.h"
+#include "Application.h"
#include "ConfigEntry.h"
+#include "ConfigManager.h"
#include <iostream>
namespace Mad {
namespace Core {
-LogManager LogManager::logManager;
-
-
void LogManager::ConsoleLogger::logMessage(MessageCategory category _UNUSED_PARAMETER_, MessageLevel level, time_t timestamp _UNUSED_PARAMETER_, const std::string &message) {
if(level != CRITICAL) {// Critical messages are printed to cerr directly, so don't print them a second time
cerrLock.lock();
@@ -49,6 +48,15 @@ void LogManager::ConsoleLogger::logMessageDirect(MessageCategory category _UNUSE
}
+LogManager::LogManager(Application *application0) : application(application0), consoleLogger(new ConsoleLogger), configured(false), running(false) {
+ application->getConfigManager()->registerConfigurable(this);
+}
+
+LogManager::~LogManager() {
+ application->getConfigManager()->unregisterConfigurable(this);
+}
+
+
bool LogManager::handleConfigEntry(const ConfigEntry &entry, bool handled) {
if(handled)
return false;
@@ -61,7 +69,7 @@ bool LogManager::handleConfigEntry(const ConfigEntry &entry, bool handled) {
}
}
else if(entry[1].empty()) {
- Logger::logf(Logger::WARNING, "Unknown logger '%s'.", entry[0][0].c_str());
+ application->logf(Logger::WARNING, "Unknown logger '%s'.", entry[0][0].c_str());
return true;
}
}