diff options
author | Jeremy Nimmer <jeremy.nimmer@tri.global> | 2018-06-13 14:42:20 +0300 |
---|---|---|
committer | Jeremy Nimmer <jeremy.nimmer@tri.global> | 2018-06-13 14:42:20 +0300 |
commit | b3881b9c15d9a4529c4a57b17b88c3faeba01255 (patch) | |
tree | 9665b191e571cf01fb167974e86eb4a3746c71c2 | |
parent | 032035e72f73b232e2fa087dc6021a3732c9f6ae (diff) |
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.
-rw-r--r-- | include/spdlog/sinks/dist_sink.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/spdlog/sinks/dist_sink.h b/include/spdlog/sinks/dist_sink.h index 1265cc7e..b4a7b6a1 100644 --- a/include/spdlog/sinks/dist_sink.h +++ b/include/spdlog/sinks/dist_sink.h @@ -62,6 +62,12 @@ public: std::lock_guard<Mutex> lock(base_sink<Mutex>::_mutex); _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>; |