add remove_all_sinks method to dist_sink

This allows users to set exactly the sinks they want, even if other
unknown application code has added bespoke sinks in the meantime.
This commit is contained in:
Jeremy Nimmer 2018-06-13 07:42:20 -04:00
parent 032035e72f
commit b3881b9c15

View File

@ -62,6 +62,12 @@ public:
std::lock_guard<Mutex> lock(base_sink<Mutex>::_mutex); std::lock_guard<Mutex> lock(base_sink<Mutex>::_mutex);
_sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end()); _sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end());
} }
void remove_all_sinks()
{
std::lock_guard<Mutex> lock(base_sink<Mutex>::_mutex);
_sinks.clear();
}
}; };
using dist_sink_mt = dist_sink<std::mutex>; using dist_sink_mt = dist_sink<std::mutex>;