From 679fcd787f9e51c38157e9644499f91e14019c51 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Wed, 29 Aug 2018 12:29:32 -0400 Subject: [PATCH] Add set_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 8d2f6f9e..b3e2e525 100644 --- a/include/spdlog/sinks/dist_sink.h +++ b/include/spdlog/sinks/dist_sink.h @@ -40,6 +40,12 @@ public: sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end()); } + void set_sinks(std::vector> sinks) + { + std::lock_guard lock(base_sink::mutex_); + sinks_ = std::move(sinks); + } + protected: void sink_it_(const details::log_msg &msg) override {