Skip to content

Commit

Permalink
[ESP32] Add an option to set default log level for CHIP logs (#35442)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinmayLonkar authored and pull[bot] committed Oct 9, 2024
1 parent 4dcb48c commit ce655b5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,25 @@ if (CONFIG_CHIP_CONFIG_IM_PRETTY_PRINT)
endif()

# Config the chip log level by IDF menuconfig
if (CONFIG_LOG_DEFAULT_LEVEL GREATER_EQUAL 1)
if (CONFIG_CHIP_LOG_DEFAULT_LEVEL GREATER_EQUAL 1)
chip_gn_arg_bool ("chip_error_logging" "true")
else()
chip_gn_arg_bool ("chip_error_logging" "false")
endif()

if (CONFIG_LOG_DEFAULT_LEVEL GREATER_EQUAL 3)
if (CONFIG_CHIP_LOG_DEFAULT_LEVEL GREATER_EQUAL 3)
chip_gn_arg_bool ("chip_progress_logging" "true")
else()
chip_gn_arg_bool ("chip_progress_logging" "false")
endif()

if (CONFIG_LOG_DEFAULT_LEVEL GREATER_EQUAL 4)
if (CONFIG_CHIP_LOG_DEFAULT_LEVEL GREATER_EQUAL 4)
chip_gn_arg_bool ("chip_detail_logging" "true")
else()
chip_gn_arg_bool ("chip_detail_logging" "false")
endif()

if (CONFIG_LOG_DEFAULT_LEVEL GREATER_EQUAL 5)
if (CONFIG_CHIP_LOG_DEFAULT_LEVEL GREATER_EQUAL 5)
chip_gn_arg_bool ("chip_automation_logging" "true")
else()
chip_gn_arg_bool ("chip_automation_logging" "false")
Expand Down
30 changes: 30 additions & 0 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,36 @@ menu "CHIP Device Layer"
To see detailed logging please set default log level to Debug.
(Component config --> Log output --> Default log verbosity --> Debug)

choice CHIP_LOG_DEFAULT_LEVEL
bool "CHIP default log verbosity"
default CHIP_LOG_DEFAULT_LEVEL_EQUALS_LOG_DEFAULT_LEVEL
help
Default log level for CHIP logs. Note that CHIP_LOG_DEFAULT_LEVEL can only be less than or equal to LOG_DEFAULT_LEVEL.

config CHIP_LOG_DEFAULT_LEVEL_EQUALS_LOG_DEFAULT_LEVEL
bool "Same as default log level"
config CHIP_LOG_DEFAULT_LEVEL_NONE
bool "CHIP logging disabled"
config CHIP_LOG_DEFAULT_LEVEL_ERROR
bool "Enable Error Logs"
config CHIP_LOG_DEFAULT_LEVEL_PROGRESS
bool "Enable Progress Logs"
config CHIP_LOG_DEFAULT_LEVEL_DETAIL
bool "Enable Detail Logs"
config CHIP_LOG_DEFAULT_LEVEL_AUTOMATION
bool "Enable Automation Logs"
endchoice

config CHIP_LOG_DEFAULT_LEVEL
int
range 0 LOG_DEFAULT_LEVEL
default LOG_DEFAULT_LEVEL if CHIP_LOG_DEFAULT_LEVEL_EQUALS_LOG_DEFAULT_LEVEL
default 0 if CHIP_LOG_DEFAULT_LEVEL_NONE
default 1 if CHIP_LOG_DEFAULT_LEVEL_ERROR
default 3 if CHIP_LOG_DEFAULT_LEVEL_PROGRESS
default 4 if CHIP_LOG_DEFAULT_LEVEL_DETAIL
default 5 if CHIP_LOG_DEFAULT_LEVEL_AUTOMATION

endmenu

config CHIP_ENABLE_BDX_LOG_TRANSFER
Expand Down

0 comments on commit ce655b5

Please sign in to comment.