Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
FileSink.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <fstream>
4#include <memory>
5#include <string>
6
8
11class FileSink : public ILogSink {
12 public:
13 explicit FileSink(const std::string& path, LogLevel minLevel = LogLevel::Debug);
14
17 static std::unique_ptr<FileSink> forRun(const std::string& tag,
18 LogLevel minLevel = LogLevel::Debug);
19
20 void write(LogLevel level, const std::string& line) override;
21
22 private:
23 std::ofstream _out;
25};
LogLevel
Definition ILogSink.hpp:5
void write(LogLevel level, const std::string &line) override
Write one already-formatted line if level passes the sink's threshold.
Definition FileSink.cpp:29
LogLevel _minLevel
Definition FileSink.hpp:24
std::ofstream _out
Definition FileSink.hpp:23
static std::unique_ptr< FileSink > forRun(const std::string &tag, LogLevel minLevel=LogLevel::Debug)
Definition FileSink.cpp:13
Output destination for a fully-formatted log line (Strategy pattern).
Definition ILogSink.hpp:14