ESP32-P4 OBC Firmware
ESP-IDF firmware for Plant-B CubeSat OBC
 
Loading...
Searching...
No Matches
pal_log.h
Go to the documentation of this file.
1
24
25#ifndef __PAL_LOG_H__
26#define __PAL_LOG_H__
27
38
50
51#ifdef ESP_PLATFORM
52#include "pal_log_esp.h"
53#endif
54
55#ifndef PAL_LOGI
63#define PAL_LOGI(tag, fmt, ...) printf("[I] %s: " fmt "\n", tag, ##__VA_ARGS__)
64#endif
65
66#ifndef PAL_LOGE
74#define PAL_LOGE(tag, fmt, ...) printf("[E] %s: " fmt "\n", tag, ##__VA_ARGS__)
75#endif
76
77#ifndef PAL_LOGW
85#define PAL_LOGW(tag, fmt, ...) printf("[W] %s: " fmt "\n", tag, ##__VA_ARGS__)
86#endif
87
88#ifndef PAL_LOGD
96#define PAL_LOGD(tag, fmt, ...) printf("[D] %s: " fmt "\n", tag, ##__VA_ARGS__)
97#endif
98
99#ifndef PAL_LOGV
107#define PAL_LOGV(tag, fmt, ...) printf("[V] %s: " fmt "\n", tag, ##__VA_ARGS__)
108#endif
109
110#ifndef PAL_LOG_BUFFER_HEX
117static const char* _pal_level_str[] = { "E", "W", "I", "D", "V" };
118
129#define PAL_LOG_BUFFER_HEX(tag, buf, len, level) \
130 do { \
131 const uint8_t *_b = (const uint8_t *)(buf); \
132 for (size_t _i = 0; _i < (len); _i += 16) { \
133 char _line[64]; \
134 int _off = 0; \
135 for (size_t _j = _i; _j < (len) && _j < _i + 16; _j++) \
136 _off += snprintf(_line + _off, sizeof(_line) - _off, "%02x ", _b[_j]); \
137 printf("[%s] %s: %s\n", _pal_level_str[level], tag, _line); \
138 } \
139 } while(0)
140#endif
141
142#ifndef PAL_LOG_BUFFER_HEXDUMP
155#define PAL_LOG_BUFFER_HEXDUMP(tag, buf, len, level) \
156 PAL_LOG_BUFFER_HEX(tag, buf, len, level)
157#endif
158 // end of pal_log group
160
161#endif // __PAL_LOG_H__
162
static const char * _pal_level_str[]
Mapping table from pal_log_level_t to PAL log level prefixes.
Definition pal_log.h:117
pal_log_level_t
Log severity levels in ascending order of verbosity.
Definition pal_log.h:43
@ PAL_LOG_ERROR
Critical errors that require immediate attention.
Definition pal_log.h:44
@ PAL_LOG_DEBUG
Detailed debug information.
Definition pal_log.h:47
@ PAL_LOG_INFO
General informational messages.
Definition pal_log.h:46
@ PAL_LOG_VERBOSE
Highly verbose trace-level output.
Definition pal_log.h:48
@ PAL_LOG_WARN
Warnings about recoverable unexpected conditions.
Definition pal_log.h:45
ESP32 platform aliases for PAL logging macros.