Last active
April 15, 2025 06:33
-
-
Save arifbalik/6d8babc2c9dfcc631fc2abb074c73d65 to your computer and use it in GitHub Desktop.
Zephyr Style Logging in ESP-IDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LOG_COMPAT_H | |
#define LOG_COMPAT_H | |
#include <esp_log.h> | |
#define TAG __FILENAME__ | |
#define LOG_ERR(fmt, ...) ESP_LOGE(TAG, fmt, ##__VA_ARGS__) | |
#define LOG_WRN(fmt, ...) ESP_LOGW(TAG, fmt, ##__VA_ARGS__) | |
#define LOG_INF(fmt, ...) ESP_LOGI(TAG, fmt, ##__VA_ARGS__) | |
#define LOG_DBG(fmt, ...) ESP_LOGD(TAG, fmt, ##__VA_ARGS__) | |
#define LOG_HEXDUMP_ERR(data, len, header) \ | |
LOG_ERR("%s", header); \ | |
ESP_LOG_BUFFER_HEXDUMP(TAG, data, len, ESP_LOG_ERROR) | |
#define LOG_HEXDUMP_WRN(data, len, header) \ | |
LOG_WRN("%s", header); \ | |
ESP_LOG_BUFFER_HEXDUMP(TAG, data, len, ESP_LOG_WARN) | |
#define LOG_HEXDUMP_INF(data, len, header) \ | |
LOG_INF("%s", header); \ | |
ESP_LOG_BUFFER_HEXDUMP(TAG, data, len, ESP_LOG_INFO) | |
#define LOG_HEXDUMP_DBG(data, len, header) \ | |
LOG_DBG("%s", header); \ | |
ESP_LOG_BUFFER_HEXDUMP(TAG, data, len, ESP_LOG_DEBUG) | |
#endif /* LOG_COMPAT_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment