Added a way to iterate all registered loggers (issues #238 and #259).

This commit is contained in:
gabime
2016-08-20 13:37:36 +03:00
parent 1c4da3eef3
commit 3af247fbd3
4 changed files with 26 additions and 9 deletions

View File

@@ -71,6 +71,13 @@ public:
return new_logger;
}
void apply_all(std::function<void(std::shared_ptr<logger>)> fun)
{
std::lock_guard<Mutex> lock(_mutex);
for (auto &l : _loggers)
fun(l.second);
}
void drop(const std::string& logger_name)
{
std::lock_guard<Mutex> lock(_mutex);