Commit 916a686f authored by gabime's avatar gabime

astyle

parent 2c32f826
...@@ -30,33 +30,33 @@ public: ...@@ -30,33 +30,33 @@ public:
virtual ~dist_sink() = default; virtual ~dist_sink() = default;
protected: protected:
std::vector<std::shared_ptr<sink>> _sinks; std::vector<std::shared_ptr<sink>> _sinks;
void _sink_it(const details::log_msg& msg) override void _sink_it(const details::log_msg& msg) override
{ {
for (auto &sink : _sinks) for (auto &sink : _sinks)
sink->log(msg); sink->log(msg);
} }
public: public:
void flush() override void flush() override
{ {
std::lock_guard<Mutex> lock(_mutex); std::lock_guard<Mutex> lock(_mutex);
for (auto &sink : _sinks) for (auto &sink : _sinks)
sink->flush(); sink->flush();
} }
void add_sink(std::shared_ptr<sink> sink) void add_sink(std::shared_ptr<sink> sink)
{ {
std::lock_guard<Mutex> lock(_mutex); std::lock_guard<Mutex> lock(_mutex);
_sinks.push_back(sink); _sinks.push_back(sink);
} }
void remove_sink(std::shared_ptr<sink> sink) void remove_sink(std::shared_ptr<sink> sink)
{ {
std::lock_guard<Mutex> lock(_mutex); std::lock_guard<Mutex> lock(_mutex);
_sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end()); _sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink), _sinks.end());
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment