2016-01-18 15:33:29 +00:00
|
|
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
2015-04-23 16:07:22 +00:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include "LoggerGroup.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
namespace Logging {
|
2015-04-23 16:07:22 +00:00
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
LoggerGroup::LoggerGroup(Level level) : CommonLogger(level) {
|
2015-04-23 16:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoggerGroup::addLogger(ILogger& logger) {
|
|
|
|
loggers.push_back(&logger);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoggerGroup::removeLogger(ILogger& logger) {
|
|
|
|
loggers.erase(std::remove(loggers.begin(), loggers.end(), &logger), loggers.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoggerGroup::operator()(const std::string& category, Level level, boost::posix_time::ptime time, const std::string& body) {
|
2015-05-27 12:08:46 +00:00
|
|
|
if (level <= logLevel && disabledCategories.count(category) == 0) {
|
|
|
|
for (auto& logger : loggers) {
|
|
|
|
(*logger)(category, level, time, body);
|
|
|
|
}
|
2015-04-23 16:07:22 +00:00
|
|
|
}
|
2014-08-13 10:51:37 +00:00
|
|
|
}
|
2015-04-23 16:07:22 +00:00
|
|
|
|
|
|
|
}
|