summaryrefslogtreecommitdiffstats
path: root/src/modules/FileLogger/Module.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-08-31 21:21:09 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-08-31 21:21:09 +0200
commit7890312d0a850ffc5be20d078d7e8f2d148dca3e (patch)
treea466ac9d3d0a8ecde06fa5c03b154480361cfdf5 /src/modules/FileLogger/Module.cpp
parent053843f893dd5c96a88e285cf2a5b35419f7dfca (diff)
downloadmad-7890312d0a850ffc5be20d078d7e8f2d148dca3e.tar
mad-7890312d0a850ffc5be20d078d7e8f2d148dca3e.zip
LogManager überarbeitet
Diffstat (limited to 'src/modules/FileLogger/Module.cpp')
-rw-r--r--src/modules/FileLogger/Module.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/FileLogger/Module.cpp b/src/modules/FileLogger/Module.cpp
index e715386..88d475c 100644
--- a/src/modules/FileLogger/Module.cpp
+++ b/src/modules/FileLogger/Module.cpp
@@ -30,21 +30,34 @@ bool Module::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) {
if(handled)
return false;
- if(entry[0].getKey().matches("Logger")) {
+ if(entry[0].getKey().matches("Log")) {
if(entry[0][0].matches("File")) {
if(entry[1].empty()) {
if(!entry[0][1].empty()) {
- boost::shared_ptr<FileLogger> logger(new FileLogger(entry[0][1]));
+ lastLogger.reset(new FileLogger(entry[0][1]));
- loggers.insert(logger);
- application->getLogManager()->registerLogger(boost::static_pointer_cast<Core::Logger>(logger));
+ loggers.insert(lastLogger);
+ application->getLogManager()->registerLogger(lastLogger);
}
else {
- application->logf(Core::LoggerBase::LOG_WARNING, "FileLogger: no filename given.");
+ lastLogger.reset();
+ application->logf(Core::Logger::LOG_WARNING, "FileLogger: no filename given.");
}
return true;
}
+ else if(entry[1].getKey().matches("Level")) {
+ if(entry[2].empty()) {
+ try {
+ lastLogger->setLevel(Core::LogManager::parseLevel(entry[1][0]));
+ }
+ catch(Core::Exception e) {
+ application->logf(Core::Logger::LOG_WARNING, "Unknown log level '%s'.", entry[1][0].c_str());
+ }
+
+ return true;
+ }
+ }
}
}