|
| | Logger (std::string name, LogLevel level=LogLevel::Trace) |
| | Creates a logger without sinks; add them with addSink().
|
| |
| | ~Logger () |
| |
| | Logger (const Logger &)=delete |
| |
| Logger & | operator= (const Logger &)=delete |
| |
| const std::string & | getName () const noexcept |
| |
| void | setLevel (LogLevel level) noexcept |
| | Minimum level to log; LogLevel::Off disables the logger.
|
| |
| LogLevel | getLevel () const noexcept |
| |
| bool | shouldLog (LogLevel level) const noexcept |
| | Whether a message at level would be logged.
|
| |
| void | flushOn (LogLevel level) noexcept |
| | Flushes the sinks after every message at level or above.
|
| |
| LogLevel | getFlushLevel () const noexcept |
| |
| void | addSink (std::shared_ptr< ISink > sink) |
| |
| void | addSink (std::shared_ptr< ISink > sink, RingBufferSink &history) |
| | Adds sink after replaying the messages kept by history into it.
|
| |
| bool | removeSink (const std::shared_ptr< ISink > &sink) noexcept |
| | Removes sink; returns false if it was not attached.
|
| |
| void | clearSinks () noexcept |
| |
| std::size_t | sinkCount () const noexcept |
| |
| template<class... Args> |
| void | log (LogLevel level, const SourceLocation &source, std::format_string< Args... > format, Args &&... args) noexcept |
| | Logs a message at level with its source location.
|
| |
| void | vlog (LogLevel level, const SourceLocation &source, std::string_view category, std::string_view format, std::format_args args) noexcept |
| | Same as log() with a runtime format string, for wrappers.
|
| |
| template<class... Args> |
| void | trace (std::format_string< Args... > format, Args &&... args) noexcept |
| | Logs at a fixed level: trace(), debug(), info(), warn(), error() and fatal().
|
| |
| template<class... Args> |
| void | debug (std::format_string< Args... > format, Args &&... args) noexcept |
| |
| template<class... Args> |
| void | info (std::format_string< Args... > format, Args &&... args) noexcept |
| |
| template<class... Args> |
| void | warn (std::format_string< Args... > format, Args &&... args) noexcept |
| |
| template<class... Args> |
| void | error (std::format_string< Args... > format, Args &&... args) noexcept |
| |
| template<class... Args> |
| void | fatal (std::format_string< Args... > format, Args &&... args) noexcept |
| |
| void | log (LogLevel level, std::string_view message, const SourceLocation &source={}) noexcept |
| | Logs message as is, without formatting.
|
| |
| void | trace (std::string_view message) noexcept |
| |
| void | debug (std::string_view message) noexcept |
| |
| void | info (std::string_view message) noexcept |
| |
| void | warn (std::string_view message) noexcept |
| |
| void | error (std::string_view message) noexcept |
| |
| void | fatal (std::string_view message) noexcept |
| |
| void | flush () noexcept |
| | Flushes every sink.
|
| |
Named logger that formats messages and sends them to its sinks; thread-safe.
Messages use std::format syntax, checked at compile time, and are skipped before any formatting when their level is below getLevel().
- Examples
- quickstart.cpp.