diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index e92764e5dfa078..077331b16cb3ef 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -112,9 +112,9 @@ menu "CHIP Core" int "Set threshold in ms" default 700 help - Time threshold for events dispatching. By default set to 0 to - to disable event dispatching time measurement and suppress the - logs for Long dispatch time. + Time threshold for warning that dispatched took too long. You can + set this default set to 0 to to disable event dispatching time + measurement and suppress the logs "Long dispatch time:...". # TODO: add log level selection diff --git a/src/platform/ESP32/Logging.cpp b/src/platform/ESP32/Logging.cpp index 7f96a70dabecb2..b2fbaac3cfbd1a 100644 --- a/src/platform/ESP32/Logging.cpp +++ b/src/platform/ESP32/Logging.cpp @@ -26,35 +26,20 @@ void ENFORCE_FORMAT(3, 0) LogV(const char * module, uint8_t category, const char snprintf(tag, sizeof(tag), "chip[%s]", module); tag[sizeof(tag) - 1] = 0; + char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; + vsnprintf(formattedMsg, sizeof(formattedMsg), msg, v); + switch (category) { case kLogCategory_Error: - if (esp_log_default_level >= ESP_LOG_ERROR) - { - printf(LOG_COLOR_E "E"); // set color - printf(" (%u) %s: ", esp_log_timestamp(), tag); // add timestamp - esp_log_writev(ESP_LOG_ERROR, tag, msg, v); - printf(LOG_RESET_COLOR "\n"); - } + ESP_LOGE(tag, "%s", formattedMsg); break; case kLogCategory_Progress: default: - if (esp_log_default_level >= ESP_LOG_INFO) - { - printf(LOG_COLOR_I "I"); // set color - printf(" (%u) %s: ", esp_log_timestamp(), tag); // add timestamp - esp_log_writev(ESP_LOG_INFO, tag, msg, v); - printf(LOG_RESET_COLOR "\n"); - } + ESP_LOGI(tag, "%s", formattedMsg); break; case kLogCategory_Detail: - if (esp_log_default_level >= ESP_LOG_DEBUG) - { - printf(LOG_COLOR_D "D"); // set color - printf(" (%u) %s: ", esp_log_timestamp(), tag); // add timestamp - esp_log_writev(ESP_LOG_DEBUG, tag, msg, v); - printf(LOG_RESET_COLOR "\n"); - } + ESP_LOGD(tag, "%s", formattedMsg); break; } }