|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
Lightweight logger bound to a specific tag. More...
Public Member Functions | |
| constexpr | logger (const char *tag) noexcept |
| Construct a logger with the given tag. | |
| constexpr const char * | tag () const noexcept |
| Get the tag associated with this logger. | |
| template<typename... Args> | |
| void | log (level lvl, std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at the specified level. | |
| void | log (level lvl, std::string_view msg) const |
| Log a pre-formatted message at the specified level. | |
| template<typename... Args> | |
| void | error (std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at error level. | |
| void | error (std::string_view msg) const |
| Log a pre-formatted message at error level. | |
| template<typename... Args> | |
| void | warn (std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at warning level. | |
| void | warn (std::string_view msg) const |
| Log a pre-formatted message at warning level. | |
| template<typename... Args> | |
| void | info (std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at info level. | |
| void | info (std::string_view msg) const |
| Log a pre-formatted message at info level. | |
| template<typename... Args> | |
| void | debug (std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at debug level. | |
| void | debug (std::string_view msg) const |
| Log a pre-formatted message at debug level. | |
| template<typename... Args> | |
| void | verbose (std::format_string< Args... > fmt, Args &&... args) const |
| Log a message at verbose level. | |
| void | verbose (std::string_view msg) const |
| Log a pre-formatted message at verbose level. | |
| void | set_level (level lvl) const |
| Set the runtime log level for this logger's tag. | |
| void | buffer_hex (level lvl, const void *buffer, uint16_t length) const |
| Log a buffer as hexadecimal bytes. | |
| template<std::ranges::contiguous_range R> requires (sizeof(std::ranges::range_value_t<R>) == 1) | |
| void | buffer_hex (level lvl, const R &data) const |
| Log a contiguous range as hexadecimal bytes. | |
| void | buffer_char (level lvl, const void *buffer, uint16_t length) const |
| Log a buffer as printable characters. | |
| template<std::ranges::contiguous_range R> requires (sizeof(std::ranges::range_value_t<R>) == 1) | |
| void | buffer_char (level lvl, const R &data) const |
| Log a contiguous range as printable characters. | |
| void | buffer_hex_dump (level lvl, const void *buffer, uint16_t length) const |
| Log a buffer as a formatted hex dump. | |
| template<std::ranges::contiguous_range R> requires (sizeof(std::ranges::range_value_t<R>) == 1) | |
| void | buffer_hex_dump (level lvl, const R &data) const |
| Log a contiguous range as a formatted hex dump. | |
Lightweight logger bound to a specific tag.
A value type that associates a tag string with logging methods, avoiding repetition of the tag in every call. The tag pointer must remain valid for the lifetime of the logger (string literals are recommended).
Log a contiguous range as printable characters.
Non-printable characters are not shown. Only the first 65535 bytes are logged; any remainder is silently truncated.
| R | A contiguous range type (e.g., std::vector, std::span, std::array). |
| lvl | The log severity level. |
| data | The data to log. |
Definition at line 557 of file log.hpp.
References idfxx::log::buffer_char().
|
inline |
Log a buffer as printable characters.
| lvl | The log severity level. |
| buffer | Pointer to the buffer data. |
| length | Number of bytes to log. |
Definition at line 541 of file log.hpp.
References idfxx::log::buffer_char().
Log a contiguous range as hexadecimal bytes.
Only the first 65535 bytes are logged; any remainder is silently truncated.
| R | A contiguous range type (e.g., std::vector, std::span, std::array). |
| lvl | The log severity level. |
| data | The data to log. |
Definition at line 530 of file log.hpp.
References idfxx::log::buffer_hex().
|
inline |
Log a buffer as hexadecimal bytes.
| lvl | The log severity level. |
| buffer | Pointer to the buffer data. |
| length | Number of bytes to log. |
Definition at line 515 of file log.hpp.
References idfxx::log::buffer_hex().
Log a contiguous range as a formatted hex dump.
Only the first 65535 bytes are logged; any remainder is silently truncated.
| R | A contiguous range type (e.g., std::vector, std::span, std::array). |
| lvl | The log severity level. |
| data | The data to log. |
Definition at line 583 of file log.hpp.
References idfxx::log::buffer_hex_dump().
|
inline |
Log a buffer as a formatted hex dump.
| lvl | The log severity level. |
| buffer | Pointer to the buffer data. |
| length | Number of bytes to log. |
Definition at line 568 of file log.hpp.
References idfxx::log::buffer_hex_dump().
|
inline |
Log a message at debug level.
| Args | Format argument types, deduced from the arguments. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 468 of file log.hpp.
References idfxx::log::debug.
|
inline |
Log a pre-formatted message at debug level.
| msg | The message string to log. |
Definition at line 477 of file log.hpp.
References idfxx::log::debug.
|
inline |
Log a message at error level.
| Args | Format argument types, deduced from the arguments. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 411 of file log.hpp.
References idfxx::log::error.
|
inline |
Log a pre-formatted message at error level.
| msg | The message string to log. |
Definition at line 420 of file log.hpp.
References idfxx::log::error.
|
inline |
Log a message at info level.
| Args | Format argument types, deduced from the arguments. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 449 of file log.hpp.
References idfxx::log::info.
|
inline |
Log a pre-formatted message at info level.
| msg | The message string to log. |
Definition at line 458 of file log.hpp.
References idfxx::log::info.
|
inline |
Log a message at the specified level.
| Args | Format argument types, deduced from the arguments. |
| lvl | The log severity level. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 391 of file log.hpp.
References idfxx::log::log().
Log a pre-formatted message at the specified level.
| lvl | The log severity level. |
| msg | The message string to log. |
Definition at line 401 of file log.hpp.
References idfxx::log::log().
Set the runtime log level for this logger's tag.
Messages with a severity below the configured level are suppressed at runtime.
| lvl | The minimum severity level to output. |
|
inline |
Log a message at verbose level.
| Args | Format argument types, deduced from the arguments. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 487 of file log.hpp.
References idfxx::log::verbose.
|
inline |
Log a pre-formatted message at verbose level.
| msg | The message string to log. |
Definition at line 496 of file log.hpp.
References idfxx::log::verbose.
|
inline |
Log a message at warning level.
| Args | Format argument types, deduced from the arguments. |
| fmt | A std::format format string, validated at compile time. |
| args | Arguments to format into the message. |
Definition at line 430 of file log.hpp.
References idfxx::log::warn.
|
inline |
Log a pre-formatted message at warning level.
| msg | The message string to log. |
Definition at line 439 of file log.hpp.
References idfxx::log::warn.