|
| #define | PAL_LOGI(tag, fmt, ...) |
| | Log an informational message.
|
| |
| #define | PAL_LOGE(tag, fmt, ...) |
| | Log an error message.
|
| |
| #define | PAL_LOGW(tag, fmt, ...) |
| | Log a warning message.
|
| |
| #define | PAL_LOGD(tag, fmt, ...) |
| | Log a debug message.
|
| |
| #define | PAL_LOGV(tag, fmt, ...) |
| | Log a verbose message.
|
| |
| #define | PAL_LOG_BUFFER_HEX(tag, buf, len, level) |
| | Dump a buffer as hexadecimal bytes at the specified log level.
|
| |
| #define | PAL_LOG_BUFFER_HEXDUMP(tag, buf, len, level) |
| | Dump a buffer as a hex dump at the specified log level.
|
| |
- Copyright
- Copyright (c) 2026 Adrien Chevrier. Under AGPL-3.0-or-later license.
Platform-agnostic logging macros. On ESP32 targets, the macros delegate to their ESP-IDF ESP_LOGx counterparts via pal_log_esp.h. On other platforms they fall back to printf with a level prefix.
◆ PAL_LOG_BUFFER_HEX
| #define PAL_LOG_BUFFER_HEX |
( |
| tag, |
|
|
| buf, |
|
|
| len, |
|
|
| level ) |
Value: do { \
const uint8_t *_b = (const uint8_t *)(buf); \
for (size_t _i = 0; _i < (len); _i += 16) { \
char _line[64]; \
int _off = 0; \
for (size_t _j = _i; _j < (len) && _j < _i + 16; _j++) \
_off += snprintf(_line + _off, sizeof(_line) - _off, "%02x ", _b[_j]); \
} \
} while(0)
static const char * _pal_level_str[]
Mapping table from pal_log_level_t to PAL log level prefixes.
Definition pal_log.h:117
Dump a buffer as hexadecimal bytes at the specified log level.
Output is split into lines of up to 16 bytes.
- Parameters
-
| tag | Null-terminated string identifying the component. |
| buf | Pointer to the buffer to dump. |
| len | Number of bytes to dump. |
| level | Log level from pal_log_level_t. |
◆ PAL_LOG_BUFFER_HEXDUMP
| #define PAL_LOG_BUFFER_HEXDUMP |
( |
| tag, |
|
|
| buf, |
|
|
| len, |
|
|
| level ) |
Value:
#define PAL_LOG_BUFFER_HEX(tag, buf, len, level)
Dump a buffer as hexadecimal bytes at the specified log level.
Definition pal_log.h:129
Dump a buffer as a hex dump at the specified log level.
On non-ESP platforms this is an alias for PAL_LOG_BUFFER_HEX. On ESP32 it delegates to ESP_LOG_BUFFER_HEXDUMP, which includes an ASCII column alongside the hex output.
- Parameters
-
| tag | Null-terminated string identifying the component. |
| buf | Pointer to the buffer to dump. |
| len | Number of bytes to dump. |
| level | Log level from pal_log_level_t. |
◆ PAL_LOGD
| #define PAL_LOGD |
( |
| tag, |
|
|
| fmt, |
|
|
| ... ) |
Value:printf("[D] %s: " fmt "\n", tag, ##__VA_ARGS__)
Log a debug message.
- Parameters
-
| [in] | tag | Null-terminated string identifying the component. |
| [in] | fmt | printf-style format string. |
| [in] | ... | Format arguments. |
◆ PAL_LOGE
| #define PAL_LOGE |
( |
| tag, |
|
|
| fmt, |
|
|
| ... ) |
Value:printf("[E] %s: " fmt "\n", tag, ##__VA_ARGS__)
Log an error message.
- Parameters
-
| [in] | tag | Null-terminated string identifying the component. |
| [in] | fmt | printf-style format string. |
| [in] | ... | Format arguments. |
◆ PAL_LOGI
| #define PAL_LOGI |
( |
| tag, |
|
|
| fmt, |
|
|
| ... ) |
Value:printf("[I] %s: " fmt "\n", tag, ##__VA_ARGS__)
Log an informational message.
- Parameters
-
| [in] | tag | Null-terminated string identifying the component. |
| [in] | fmt | printf-style format string. |
| [in] | ... | Format arguments. |
◆ PAL_LOGV
| #define PAL_LOGV |
( |
| tag, |
|
|
| fmt, |
|
|
| ... ) |
Value:printf("[V] %s: " fmt "\n", tag, ##__VA_ARGS__)
Log a verbose message.
- Parameters
-
| [in] | tag | Null-terminated string identifying the component. |
| [in] | fmt | printf-style format string. |
| [in] | ... | Format arguments. |
◆ PAL_LOGW
| #define PAL_LOGW |
( |
| tag, |
|
|
| fmt, |
|
|
| ... ) |
Value:printf("[W] %s: " fmt "\n", tag, ##__VA_ARGS__)
Log a warning message.
- Parameters
-
| [in] | tag | Null-terminated string identifying the component. |
| [in] | fmt | printf-style format string. |
| [in] | ... | Format arguments. |
◆ pal_log_level_t
Log severity levels in ascending order of verbosity.
| Enumerator |
|---|
| PAL_LOG_ERROR | Critical errors that require immediate attention.
|
| PAL_LOG_WARN | Warnings about recoverable unexpected conditions.
|
| PAL_LOG_INFO | General informational messages.
|
| PAL_LOG_DEBUG | Detailed debug information.
|
| PAL_LOG_VERBOSE | Highly verbose trace-level output.
|
◆ _pal_level_str
| const char* _pal_level_str[] = { "E", "W", "I", "D", "V" } |
|
static |
Mapping table from pal_log_level_t to PAL log level prefixes.
Indexed by pal_log_level_t values, used internally by PAL_LOG_BUFFER_HEX and PAL_LOG_BUFFER_HEXDUMP.