mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[cmake] support setting log level (#5433)
This commit is contained in:
@@ -103,6 +103,20 @@ if(NOT OT_PLATFORM IN_LIST OT_PLATFORMS)
|
||||
message(FATAL_ERROR "Platform unknown: ${OT_PLATFORM}")
|
||||
endif()
|
||||
|
||||
set(OT_LOG_LEVEL "" CACHE STRING "set OpenThread log level")
|
||||
set(OT_LOG_LEVEL_VALUES
|
||||
"NONE"
|
||||
"CRIT"
|
||||
"WARN"
|
||||
"NOTE"
|
||||
"INFO"
|
||||
"DEBG"
|
||||
)
|
||||
set_property(CACHE OT_LOG_LEVEL PROPERTY STRINGS ${OT_LOG_LEVEL_VALUES})
|
||||
if(OT_LOG_LEVEL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_${OT_LOG_LEVEL}")
|
||||
endif()
|
||||
|
||||
set(OT_LOG_OUTPUT_VALUES
|
||||
"APP"
|
||||
"DEBUG_UART"
|
||||
|
||||
@@ -244,7 +244,9 @@ endif()
|
||||
|
||||
option(OT_FULL_LOGS "enable full logs")
|
||||
if(OT_FULL_LOGS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
if(NOT OT_LOG_LEVEL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
endif()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_API=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_ARP=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_BBR=1")
|
||||
|
||||
+1
-1
@@ -313,7 +313,7 @@ EXAMPLES:
|
||||
do_package()
|
||||
{
|
||||
local builddir
|
||||
local options=("-DCMAKE_BUILD_TYPE=Release")
|
||||
local options=("-DCMAKE_BUILD_TYPE=Release" "-DOT_LOG_LEVEL=INFO")
|
||||
|
||||
if [[ ${ot_extra_options[*]+x} ]]; then
|
||||
options+=("${ot_extra_options[@]}")
|
||||
|
||||
Reference in New Issue
Block a user