[ESP32] Add an option to set default log level for CHIP logs (#35442)
diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt
index 7e9894a..85141d5 100644
--- a/config/esp32/components/chip/CMakeLists.txt
+++ b/config/esp32/components/chip/CMakeLists.txt
@@ -87,25 +87,25 @@
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")
diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig
index 40beb7d..de29639 100644
--- a/config/esp32/components/chip/Kconfig
+++ b/config/esp32/components/chip/Kconfig
@@ -1172,6 +1172,36 @@
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