diff options
Diffstat (limited to 'project2/common/logger.cpp')
-rw-r--r-- | project2/common/logger.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/project2/common/logger.cpp b/project2/common/logger.cpp index 8140155..5ce82f9 100644 --- a/project2/common/logger.cpp +++ b/project2/common/logger.cpp @@ -15,23 +15,23 @@ Log::Log() : Log::~Log() { - logs.clear(); -} - -int -Log::addLogger(LogDriverBasePtr log) -{ - logs[++nextId] = log; - if (log->level > lowestLevel) { - lowestLevel = log->level; - } - return nextId; } void -Log::clear() +Log::setLoggerAt(LogDriverLoader * ldr, int level) { - logs.clear(); + if (level == -1) { + logs.erase(ldr); + } + else { + logs[ldr] = ldr->create(); + } + lowestLevel = -1; + BOOST_FOREACH(const auto & log, *Plugable::objLoaders<LogDriverLoader>()) { + if (log.second->loggerLevel() > lowestLevel) { + lowestLevel = log.second->loggerLevel(); + } + } } const char * @@ -46,7 +46,6 @@ Log::priorityName(int priority) return name; } - void Log::message(int priority, const char * msg) const { @@ -90,8 +89,7 @@ Logger::operator->() const return &log; } -LogDriverBase::LogDriverBase(int l) : - level(l) +LogDriverBase::LogDriverBase() { } |