Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
CompositeSink.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
7
9class CompositeSink : public ILogSink {
10 public:
11 void add(std::unique_ptr<ILogSink> sink);
12 void write(LogLevel level, const std::string& line) override;
13
14 private:
15 std::vector<std::unique_ptr<ILogSink>> _sinks;
16};
LogLevel
Definition ILogSink.hpp:5
Fans one write out to many sinks at once (Composite pattern).
std::vector< std::unique_ptr< ILogSink > > _sinks
void write(LogLevel level, const std::string &line) override
Write one already-formatted line if level passes the sink's threshold.
void add(std::unique_ptr< ILogSink > sink)
Output destination for a fully-formatted log line (Strategy pattern).
Definition ILogSink.hpp:14