25 void setLevel(
LogLevel level) noexcept final { _level.store(level, std::memory_order_relaxed); }
26 [[nodiscard]]
LogLevel getLevel() const noexcept final {
return _level.load(std::memory_order_relaxed); }
40 [[nodiscard]] std::mutex&
sinkMutex() noexcept {
return _mutex; }
44 std::shared_ptr<Formatter> _formatter;
Base class for sinks: handles the level, the pattern and the locking.
Definition ASink.hpp:17
void setFormatter(std::shared_ptr< Formatter > formatter) final
Shares a Formatter between sinks.
virtual void log(const LogMessage &message)=0
Writes one message; called with the sink mutex locked.
std::string_view formatted(const LogMessage &message)
The message formatted with the sink pattern.
virtual void flushSink()
Flushes the output; called with the sink mutex locked.
Definition ASink.hpp:36
std::mutex & sinkMutex() noexcept
Definition ASink.hpp:40
void write(const LogMessage &message) final
Receives a message from a logger.
LogLevel getLevel() const noexcept final
Definition ASink.hpp:26
void setPattern(std::string_view pattern) final
Formats the messages with pattern; see Formatter.
void setLevel(LogLevel level) noexcept final
Minimum level accepted by this sink.
Definition ASink.hpp:25
bool shouldLog(LogLevel level) const noexcept final
Definition ASink.hpp:27
Interface of the log destinations; derive from ASink to write a new sink.
Definition ISink.hpp:14
Thread-safe logging: loggers, sinks, patterns and macros.
Definition Terminal.hpp:8
LogLevel
Severity of a message, from Trace to Fatal; Off disables logging.
Definition LogLevel.hpp:11
A log record as passed to the sinks.
Definition LogMessage.hpp:18