Skip to content

Commit

Permalink
Respect maximum log level in esp32 pw_hdlc logger (project-chip#19401)
Browse files Browse the repository at this point in the history
Enabling HDLC & RPC causes a significant increase in logs verbosity on
ESP32 which may cause bottlenecks (even causing commissioning to fail).

Respect the maximum log level to suppress these extra logs.

It would be more efficient to check this at the logging call sites, but
using a platform specific level limit is not easily supported with the
matter logging stack (instead, there are separate build time toggles
such as CHIP_DETAIL_LOGGING).
  • Loading branch information
mspang authored Jun 9, 2022
1 parent 44a6f1b commit cba9187
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/platform/esp32/PigweedLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ extern "C" void __wrap_esp_log_write(esp_log_level_t level, const char * tag, co
{
va_list v;
va_start(v, format);

#ifndef CONFIG_LOG_DEFAULT_LEVEL_NONE
if (uartInitialised)
if (uartInitialised && level <= CONFIG_LOG_MAXIMUM_LEVEL)
{
char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE];
size_t len = vsnprintf(formattedMsg, sizeof formattedMsg, format, v);
Expand All @@ -102,6 +103,7 @@ extern "C" void __wrap_esp_log_write(esp_log_level_t level, const char * tag, co
PigweedLogger::putString(formattedMsg, len);
}
#endif

va_end(v);
}

Expand Down

0 comments on commit cba9187

Please sign in to comment.