From d6ecb74f96d58bb07d9e9497dc913e74b9541b63 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sat, 30 Apr 2022 14:09:50 +0200 Subject: [PATCH] cpu/esp32: cleanup of esp_log_write --- cpu/esp32/esp-idf/esp_idf_support.c | 35 +------------------------ cpu/esp_common/include/esp_common_log.h | 3 ++- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/cpu/esp32/esp-idf/esp_idf_support.c b/cpu/esp32/esp-idf/esp_idf_support.c index 68df4122076c..6378932aa09c 100644 --- a/cpu/esp32/esp-idf/esp_idf_support.c +++ b/cpu/esp32/esp-idf/esp_idf_support.c @@ -87,8 +87,6 @@ static esp_log_level_entry_t _log_levels[] = { { .tag = "*", .level = LOG_DEBUG }, }; -static char _printf_buf[PRINTF_BUFSIZ]; - /* * provided by: /path/to/esp-idf/component/log/log.c */ @@ -131,39 +129,8 @@ void IRAM_ATTR esp_log_writev(esp_log_level_t level, if ((unsigned)act_level > CONFIG_LOG_DEFAULT_LEVEL) { return; } -#if 0 /* seems not to be required any longer */ - /* - * The format of log output from ESP SDK libraries is "X (s) t: message\n" - * where X is the log level, d the system time in milliseconds and t the - * tag. To be able to enable these additional information by module - * `esp_log_tagged`, we have to separate these information from the - * message here. - */ - const char* msg = (strchr (format, ':') + 2); - - va_list arglist; - va_copy(arglist, args); - - /* remove time and tag argument from argument list */ - va_arg(arglist, unsigned); - va_arg(arglist, const char*); - vsnprintf(_printf_buf, PRINTF_BUFSIZ, msg, arglist); - va_end(arglist); -#else - va_list arglist; - va_copy(arglist, args); - vsnprintf(_printf_buf, PRINTF_BUFSIZ, format, arglist); - va_end(arglist); -#endif - switch (act_level) { - case LOG_NONE : return; - case LOG_ERROR : LOG_TAG_ERROR (tag, "%s", _printf_buf); break; - case LOG_WARNING: LOG_TAG_WARNING(tag, "%s", _printf_buf); break; - case LOG_INFO : LOG_TAG_INFO (tag, "%s", _printf_buf); break; - case LOG_DEBUG : LOG_TAG_DEBUG (tag, "%s", _printf_buf); break; - case LOG_ALL : LOG_TAG_ALL (tag, "%s", _printf_buf); break; - } + vprintf(format, args); } /* diff --git a/cpu/esp_common/include/esp_common_log.h b/cpu/esp_common/include/esp_common_log.h index c64855a75a8a..eb3989180f62 100644 --- a/cpu/esp_common/include/esp_common_log.h +++ b/cpu/esp_common/include/esp_common_log.h @@ -28,6 +28,7 @@ extern "C" { #include #include +#include #include "log.h" @@ -56,7 +57,7 @@ extern int ets_printf(const char *fmt, ...); #if MODULE_ESP_LOG_TAGGED -#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) [%s] " format LOG_RESET_COLOR +#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") [%s] " format LOG_RESET_COLOR #define LOG_TAG(level, letter, tag, format, ...) \ do { \