12 explicit OStreamSink(std::ostream& stream) : _stream(stream) {}
17 const std::string_view line =
formatted(message);
18 _stream.write(line.data(),
static_cast<std::streamsize
>(line.size()));
25 std::ostream& _stream;
Base class for sinks: handles the level, the pattern and the locking.
Definition ASink.hpp:17
std::string_view formatted(const LogMessage &message)
The message formatted with the sink pattern.
Writes plain lines to a std::ostream, which must outlive the sink.
Definition OStreamSink.hpp:10
void log(const LogMessage &message) override
Writes one message; called with the sink mutex locked.
Definition OStreamSink.hpp:15
OStreamSink(std::ostream &stream)
Definition OStreamSink.hpp:12
void flushSink() override
Flushes the output; called with the sink mutex locked.
Definition OStreamSink.hpp:22
Thread-safe logging: loggers, sinks, patterns and macros.
Definition Terminal.hpp:8
A log record as passed to the sinks.
Definition LogMessage.hpp:18