Skip to content

Commit c0f383c

Browse files
committed
cpu/esp32/esp-idf/log: migration to ESP-IDF v5.4
1 parent 84ff968 commit c0f383c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

cpu/esp32/esp-idf/include/log/esp_log.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
extern "C" {
2626
#endif
2727

28+
#include "log.h"
2829
#include_next "esp_log.h"
2930

3031
#if defined(RIOT_VERSION)
@@ -55,7 +56,7 @@ extern "C" {
5556
} while (0)
5657

5758
#define ESP_LOG_LEVEL_LOCAL(level, tag, format, ...) \
58-
do { \
59+
do { \
5960
if ( LOG_LOCAL_LEVEL >= level ) { \
6061
ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
6162
} \
@@ -69,26 +70,32 @@ extern "C" {
6970

7071
#if MODULE_ESP_LOG_TAGGED
7172

72-
#define ESP_DRAM_LOGE(tag, format, ...) \
73+
#define ESP_DRAM_LOG_LEVEL(level, letter, tag, format, ...) \
7374
do { \
74-
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= ESP_LOG_ERROR ) { \
75-
esp_rom_printf(DRAM_STR(LOG_FORMAT(E, format)), \
75+
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= level ) { \
76+
esp_rom_printf(DRAM_STR(LOG_FORMAT(letter, format)), \
7677
system_get_time_ms(), ##__VA_ARGS__); \
7778
}\
7879
} while (0U)
7980

8081
#else
8182

82-
#define ESP_DRAM_LOGE(tag, format, ...) \
83+
#define ESP_DRAM_LOG_LEVEL(level, letter, tag, format, ...) \
8384
do { \
84-
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= ESP_LOG_ERROR ) { \
85-
esp_rom_printf(DRAM_STR(LOG_FORMAT(E, format)), \
85+
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= level ) { \
86+
esp_rom_printf(DRAM_STR(LOG_FORMAT(letter, format)), \
8687
##__VA_ARGS__); \
8788
}\
8889
} while (0U)
8990

9091
#endif
9192

93+
#define ESP_DRAM_LOGE(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_ERROR , E, tag, format "\n", ##__VA_ARGS__)
94+
#define ESP_DRAM_LOGW(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_WARNING, W, tag, format "\n", ##__VA_ARGS__)
95+
#define ESP_DRAM_LOGI(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_INFO , I, tag, format "\n", ##__VA_ARGS__)
96+
#define ESP_DRAM_LOGD(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_DEBUG , D, tag, format "\n", ##__VA_ARGS__)
97+
#define ESP_DRAM_LOGV(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_ALL , V, tag, format "\n", ##__VA_ARGS__)
98+
9299
#endif /* defined(RIOT_VERSION) */
93100

94101
#ifdef __cplusplus

0 commit comments

Comments
 (0)