Logger class implementation. Provides (customizable) logging functionalities.
See Logger.h for an overview of how to observe logged events.
|
| | Logger (log::Severity min_severity=log::Severity::Normal, log::Verbosity verbosity=log::Verbosity::Info, bool enable_data_dumps=false) |
| |
| virtual | ~Logger ()=default |
| |
| SinkId | add_sink (Sink sink, log::Filter filter={}) |
| | Registers a sink receiving all events that pass the given filter.
|
| |
template<log::event_context Ctx, typename F >
requires std::invocable<F &, const log::Record &, const typename Ctx::Payload &> |
| SinkId | on (F &&f) |
| | Registers f(const log::Record &, const Ctx::Payload &) to be called for every event of context Ctx.
|
| |
| void | remove_sink (SinkId id) |
| | Removes a previously registered sink.
|
| |
template<log::event_context Ctx, typename MakePayload >
requires std::invocable<MakePayload &> |
| void | emit (log::Severity severity, log::Verbosity verbosity, std::string_view message, MakePayload &&make) const |
| | Emits an event of context Ctx.
|
| |
| template<log::event_context Ctx> |
| bool | is_wanted (log::Severity severity, log::Verbosity verbosity) const |
| |
template<log::event_context Ctx>
requires std::default_initializable<typename Ctx::Payload> |
| void | emit (log::Severity severity, log::Verbosity verbosity, std::string_view message) const |
| | Emits an event of a context whose payload is default-constructible (usually empty)
|
| |
| template<typename... Ts> |
| void | msg (log::Severity severity, log::Verbosity verbosity, std::string_view message, const Ts &...args) const |
| | Logs a free-text message (context log::Generic). The arguments are stringified and appended.
|
| |
| template<typename... Ts> |
| void | trace (std::string_view message, const Ts &...args) const |
| |
| template<typename... Ts> |
| void | debug (std::string_view message, const Ts &...args) const |
| |
| template<typename... Ts> |
| void | info (std::string_view message, const Ts &...args) const |
| |
| template<typename... Ts> |
| void | warn (std::string_view message, const Ts &...args) const |
| |
| template<typename... Ts> |
| void | error (std::string_view message, const Ts &...args) const |
| |
| template<typename... Ts> |
| void | fatal (std::string_view message, const Ts &...args) const |
| |
| template<std::size_t precision = log::default_precision, typename T > |
| void | data_dump (std::string_view what, const T &data) const |
| | Dumps data (context log::DataDump<T>, verbosity Trace). Nothing is copied.
|
| |
| log::Severity | min_severity () const |
| |
| void | set_min_severity (log::Severity severity) |
| |
| log::Verbosity | verbosity () const |
| |
| void | set_verbosity (log::Verbosity verbosity) |
| |
| bool | data_dumps_enabled () const |
| |
| void | enable_data_dumps (bool enable) |
| |
| bool | default_output () const |
| |
| void | set_default_output (bool enable) |
| | Switches the built-in text output (default_message_handler()) on or off.
|
| |