Skip to content

Commit

Permalink
Revert parts of #26227
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson committed Apr 27, 2023
1 parent c1108d7 commit 3940f15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
8 changes: 4 additions & 4 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ menu "CHIP Core"

config DISPATCH_EVENT_LONG_DISPATCH_TIME_WARNING_THRESHOLD_MS
int "Set threshold in ms"
default 700
default 100
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

Expand Down
27 changes: 6 additions & 21 deletions src/platform/ESP32/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 3940f15

Please sign in to comment.