Abstract sink for libquicr diagnostic messages.
More...
#include <log.h>
|
| enum class | Level {
Trace = QUICR_LOG_TRACE
, Debug = QUICR_LOG_DEBUG
, Info = QUICR_LOG_INFO
, Warn = QUICR_LOG_WARN
,
Error = QUICR_LOG_ERROR
, Critical = QUICR_LOG_CRITICAL
, Off = QUICR_LOG_OFF
} |
| | Log severity in increasing order. More...
|
| |
|
| virtual | ~Logger ()=default |
| | Destroy the logger. More...
|
| |
| virtual void | SetLevel (Level max_level)=0 |
| | Set the minimum severity emitted by this logger. More...
|
| |
| virtual void | Log (Level level, std::string_view msg, std::source_location location=std::source_location::current())=0 |
| | Emit an already formatted message. More...
|
| |
| virtual bool | ShouldLog (Level level) const noexcept |
| | Determine whether a message severity is enabled at compile time. More...
|
| |
| template<typename... Args> |
| void | Log (std::source_location location, Level level, std::conditional_t< sizeof...(Args)==0, std::string_view, std_or_fmt::format_string< Args... >> msg, Args &&... args) |
| | Format and emit a message if its severity is enabled. More...
|
| |
Abstract sink for libquicr diagnostic messages.
◆ Level
Log severity in increasing order.
| Enumerator |
|---|
| Trace | Fine-grained execution tracing.
|
| Debug | Diagnostic information for debugging.
|
| Info | Normal operational information.
|
| Warn | A recoverable or potentially harmful condition.
|
| Error | An operation failed.
|
| Critical | A severe failure requiring immediate attention.
|
| Off | Disable logging.
|
◆ ~Logger()
| virtual quicr::Logger::~Logger |
( |
| ) |
|
|
virtualdefault |
◆ Log() [1/2]
| virtual void quicr::Logger::Log |
( |
Level |
level, |
|
|
std::string_view |
msg, |
|
|
std::source_location |
location = std::source_location::current() |
|
) |
| |
|
pure virtual |
Emit an already formatted message.
- Parameters
-
| level | Message severity. |
| msg | Message text; implementations must not retain the view after returning. |
| location | Source location associated with the logging call. |
◆ Log() [2/2]
template<typename... Args>
| void quicr::Logger::Log |
( |
std::source_location |
location, |
|
|
Level |
level, |
|
|
std::conditional_t< sizeof...(Args)==0, std::string_view, std_or_fmt::format_string< Args... >> |
msg, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Format and emit a message if its severity is enabled.
Formatting failures derived from std::exception are converted to an error log.
- Template Parameters
-
| Args | Types of the formatting arguments. |
- Parameters
-
| location | Source location associated with the logging call. |
| level | Message severity. |
| msg | Format string, or message text when no arguments are supplied. |
| args | Arguments interpolated into msg. |
◆ SetLevel()
| virtual void quicr::Logger::SetLevel |
( |
Level |
max_level | ) |
|
|
pure virtual |
Set the minimum severity emitted by this logger.
- Parameters
-
| max_level | Severity threshold, or Level::Off to suppress all messages. |
◆ ShouldLog()
| virtual bool quicr::Logger::ShouldLog |
( |
Level |
level | ) |
const |
|
virtualnoexcept |
Determine whether a message severity is enabled at compile time.
- Parameters
-
- Returns
true when the active compile-time level permits the message.
The documentation for this class was generated from the following file: