1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu/esp32: introduce module esp_log_tagged

ESP32 log output was always tagged with additional information by default. The tag consists the type of the log message, the system time in ms, and the module or function in which the log message is generated. By introducing module `esp_log_tagged`, these additional information are disabled by default and can be enabled by using module `esp_log_tagged`.
This commit is contained in:
Gunar Schorcht 2019-08-20 16:21:36 +02:00
parent a3058291b7
commit 327b9fd32e
2 changed files with 25 additions and 0 deletions

View File

@ -60,6 +60,7 @@ PSEUDOMODULES += esp_i2c_sw
PSEUDOMODULES += esp_i2c_hw
PSEUDOMODULES += esp_idf_newlib
PSEUDOMODULES += esp_log_color
PSEUDOMODULES += esp_log_tagged
PSEUDOMODULES += esp_spi_ram
PSEUDOMODULES += esp_spiffs
PSEUDOMODULES += esp_wifi_any

View File

@ -57,6 +57,8 @@ extern uint32_t system_get_time_ms (void);
#endif /* MODULE_ESP_LOG_COLOR */
#if MODULE_ESP_LOG_TAGGED
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) [%s] " format LOG_RESET_COLOR
#define LOG_TAG(level, letter, tag, format, ...) \
@ -73,6 +75,28 @@ extern uint32_t system_get_time_ms (void);
} \
} while(0)
#else /* MODULE_ESP_LOG_TAGGED */
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter format LOG_RESET_COLOR
#define LOG_TAG(level, letter, tag, format, ...) \
do { \
(void)tag; \
if ((unsigned)level <= (unsigned)LOG_LEVEL) { \
printf(LOG_FORMAT(letter, format), ##__VA_ARGS__); \
} \
} while (0U)
#define LOG_TAG_EARLY(level, letter, tag, format, ...) \
do { \
(void)tag; \
if ((unsigned)level <= (unsigned)LOG_LEVEL) { \
ets_printf(LOG_FORMAT(letter, format), ##__VA_ARGS__); \
} \
} while (0U)
#endif /* MODULE_ESP_LOG_TAGGED */
/**
* Override LOG_* definitions with a tagged version. By default the function
* name is used as tag.