From b3881b9c15d9a4529c4a57b17b88c3faeba01255 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Wed, 13 Jun 2018 07:42:20 -0400 Subject: [PATCH] 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. --- include/spdlog/sinks/dist_sink.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 lock(base_sink::_mutex); _sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end()); } + + void remove_all_sinks() + { + std::lock_guard lock(base_sink::_mutex); + _sinks.clear(); + } }; using dist_sink_mt = dist_sink;