logging: Revamp menuconfig
Clean up logging menuconfig by grouping configuration into sections like: mode, processing configuration, backends. Additionlly, removed LOG_ENABLE_FANCY_OUTPUT_FORMATTING which is no longer in use. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
27a43808a2
commit
7f08061f0c
43 changed files with 639 additions and 592 deletions
|
@ -43,16 +43,6 @@ if LOG
|
|||
config LOG_BACKEND_NATIVE_POSIX
|
||||
default y if !SERIAL
|
||||
|
||||
# For native_posix we can log immediately without any problem
|
||||
# Doing so will be nicer for debugging
|
||||
config LOG_IMMEDIATE
|
||||
default y
|
||||
|
||||
# If we set LOG_IMMEDIATE, there is no need to have the logging thread
|
||||
# running
|
||||
config LOG_PROCESS_THREAD
|
||||
default n
|
||||
|
||||
endif # LOG
|
||||
|
||||
if CONSOLE
|
||||
|
|
|
@ -4,3 +4,6 @@ CONFIG_SOC_POSIX=y
|
|||
CONFIG_BOARD_NATIVE_POSIX_32BIT=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
|
||||
# For native_posix we can log synchronously without any problem
|
||||
# Doing so will be nicer for debugging
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
|
|
|
@ -24,16 +24,6 @@ if LOG
|
|||
config LOG_BACKEND_NATIVE_POSIX
|
||||
default y if !SERIAL
|
||||
|
||||
# For this board we can log immediately without any problem
|
||||
# Doing so will be nicer for debugging
|
||||
config LOG_IMMEDIATE
|
||||
default y
|
||||
|
||||
# If we set LOG_IMMEDIATE, there is no need to have the logging thread
|
||||
# running
|
||||
config LOG_PROCESS_THREAD
|
||||
default n
|
||||
|
||||
endif # LOG
|
||||
|
||||
endif # BOARD_NRF52_BSIM
|
||||
|
|
|
@ -5,3 +5,6 @@ CONFIG_BOARD_NRF52_BSIM=y
|
|||
CONFIG_CONSOLE=y
|
||||
CONFIG_NO_OPTIMIZATIONS=y
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32768
|
||||
# For this board we can log immediately without any problem
|
||||
# Doing so will be nicer for debugging
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
|
|
|
@ -94,9 +94,6 @@ logger.
|
|||
:option:`CONFIG_LOG_MODE_OVERFLOW`: When logger cannot allocate new message
|
||||
oldest one are discarded.
|
||||
|
||||
:option:`CONFIG_LOG_MODE_NO_OVERFLOW`: When logger cannot allocate new message
|
||||
it is discarded.
|
||||
|
||||
:option:`CONFIG_LOG_BLOCK_IN_THREAD`: If enabled and new log message cannot
|
||||
be allocated thread context will block for up to
|
||||
:option:`CONFIG_LOG_BLOCK_IN_THREAD_TIMEOUT_MS` or until log message is
|
||||
|
|
|
@ -3,5 +3,5 @@ CONFIG_PRINTK=y
|
|||
CONFIG_PWM=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_PRINTK=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_PWM_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -7,4 +7,4 @@ CONFIG_CRYPTO=y
|
|||
CONFIG_CRYPTO_TINYCRYPT_SHIM=y
|
||||
CONFIG_CRYPTO_LOG_LEVEL_DBG=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_MBEDTLS=y
|
||||
CONFIG_MBEDTLS_BUILTIN=y
|
||||
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_CRYPTO=y
|
||||
CONFIG_CRYPTO_LOG_LEVEL_DBG=y
|
||||
CONFIG_CRYPTO_NRF_ECB=y
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
CONFIG_LOG=y
|
||||
CONFIG_USE_SEGGER_RTT=y
|
||||
CONFIG_LOG_MINIMAL=n
|
||||
CONFIG_LOG_PRINTK=y
|
||||
CONFIG_LOG_MODE_MINIMAL=n
|
||||
|
||||
CONFIG_I2C=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_FLASH_AT45=y
|
||||
|
|
|
@ -55,7 +55,7 @@ CONFIG_NET_SHELL=y
|
|||
CONFIG_MAIN_STACK_SIZE=4096
|
||||
|
||||
# Enable Logging support
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_NET_LOG=y
|
||||
CONFIG_NET_TCP_LOG_LEVEL_DBG=n
|
||||
CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=n
|
||||
|
|
|
@ -8,7 +8,7 @@ CONFIG_NET_IPV6_MLD=n
|
|||
# Logging
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MAX_LEVEL=1
|
||||
CONFIG_LOG_MINIMAL=n
|
||||
CONFIG_LOG_MODE_MINIMAL=n
|
||||
CONFIG_LOG_BACKEND_SPINEL=y
|
||||
CONFIG_LOG_BACKEND_RTT=y
|
||||
CONFIG_LOG_BACKEND_UART=n
|
||||
|
|
|
@ -24,7 +24,7 @@ CONFIG_TEST_RANDOM_GENERATOR=y
|
|||
CONFIG_NET_SHELL=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_NET_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
|
||||
CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
|
||||
CONFIG_CAN_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
||||
|
||||
CONFIG_NET_LOG=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
||||
|
||||
CONFIG_LOG_BUFFER_SIZE=1024
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
||||
|
||||
CONFIG_LOG_BUFFER_SIZE=1024
|
||||
|
|
|
@ -30,7 +30,7 @@ CONFIG_HTTP_CLIENT=y
|
|||
|
||||
# Network debug config
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_NET_LOG=y
|
||||
CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=n
|
||||
CONFIG_NET_HTTP_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_LOG_BACKEND_SHOW_COLOR=n
|
||||
|
||||
CONFIG_NET_LOG=y
|
||||
|
|
|
@ -32,7 +32,7 @@ CONFIG_WEBSOCKET_CLIENT=y
|
|||
|
||||
# Network debug config
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_NET_LOG=y
|
||||
#CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
|
||||
#CONFIG_NET_HTTP_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -14,10 +14,9 @@ CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
|
|||
CONFIG_NET_LOG=y
|
||||
CONFIG_LOG=y
|
||||
|
||||
# Immediate logging does not work with network syslog as it would cause
|
||||
# the sent packet to be malformed (contains only 1 byte data)
|
||||
CONFIG_LOG_IMMEDIATE=n
|
||||
CONFIG_LOG_PROCESS_THREAD=y
|
||||
# Deferred mode is required, synchronous mode does not work with network syslog
|
||||
# as it would cause the sent packet to be malformed (contains only 1 byte data)
|
||||
CONFIG_LOG_MODE_DEFERRED=y
|
||||
|
||||
CONFIG_NET_IPV6=y
|
||||
CONFIG_NET_IPV4=y
|
||||
|
|
|
@ -2,7 +2,7 @@ CONFIG_ASSERT=y
|
|||
CONFIG_NUM_METAIRQ_PRIORITIES=1
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
|
||||
# We're testing delivery latency to threads on a single CPU, MP
|
||||
# dispatch will mess up the statistics.
|
||||
|
|
|
@ -2,5 +2,5 @@ CONFIG_USERSPACE=y
|
|||
CONFIG_APPLICATION_DEFINED_SYSCALL=y
|
||||
CONFIG_ASSERT=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_MAIN_STACK_SIZE=2560
|
||||
|
|
|
@ -3,4 +3,4 @@ CONFIG_HW_STACK_PROTECTION=y
|
|||
CONFIG_APPLICATION_DEFINED_SYSCALL=y
|
||||
CONFIG_ASSERT=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
|
|
|
@ -2,5 +2,5 @@ CONFIG_USERSPACE=y
|
|||
CONFIG_APPLICATION_DEFINED_SYSCALL=y
|
||||
CONFIG_ASSERT=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_MAIN_STACK_SIZE=2560
|
||||
|
|
|
@ -10,549 +10,23 @@ menuconfig LOG
|
|||
|
||||
if LOG
|
||||
|
||||
config LOG_MINIMAL
|
||||
bool "Enable minimal-footprint logging"
|
||||
imply PRINTK
|
||||
help
|
||||
Enable minimal logging implementation. This has very little footprint
|
||||
overhead on top of the printk() implementation for standard
|
||||
logging macros. Hexdump macros are also supported, with a small
|
||||
amount of code pulled in if used. Build time filtering is supported,
|
||||
but not runtime filtering. There are no timestamps, prefixes,
|
||||
colors, or asynchronous logging, and all messages are simply
|
||||
sent to printk().
|
||||
rsource "Kconfig.mode"
|
||||
|
||||
config LOG_RUNTIME_FILTERING
|
||||
bool "Enable runtime reconfiguration of the logger"
|
||||
depends on !LOG_FRONTEND && !LOG_MINIMAL
|
||||
help
|
||||
Allow runtime configuration of maximal, independent severity
|
||||
level for instance.
|
||||
|
||||
config LOG_DEFAULT_LEVEL
|
||||
int "Default log level"
|
||||
default 3
|
||||
range 0 4
|
||||
help
|
||||
Sets log level for modules which don't specify it explicitly. When
|
||||
set to 0 it means log will not be activated for those modules.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, do not write by default
|
||||
- 1 ERROR, default to only write LOG_LEVEL_ERR
|
||||
- 2 WARNING, default to write LOG_LEVEL_WRN
|
||||
- 3 INFO, default to write LOG_LEVEL_INFO
|
||||
- 4 DEBUG, default to write LOG_LEVEL_DBG
|
||||
|
||||
config LOG_OVERRIDE_LEVEL
|
||||
int "Override lowest log level"
|
||||
default 0
|
||||
range 0 4
|
||||
help
|
||||
Forces a minimum log level for all modules. Modules use their
|
||||
specified level if it is greater than this option, otherwise they use
|
||||
the level specified by this option instead of their default or
|
||||
whatever was manually set.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, do not override
|
||||
- 1 ERROR, override to write LOG_LEVEL_ERR
|
||||
- 2 WARNING, override to write LOG_LEVEL_WRN
|
||||
- 3 INFO, override to write LOG_LEVEL_INFO
|
||||
- 4 DEBUG, override to write LOG_LEVEL_DBG
|
||||
|
||||
config LOG_MAX_LEVEL
|
||||
int "Maximal log level compiled in the system"
|
||||
default 4
|
||||
range 0 4
|
||||
help
|
||||
Forces a maximal log level for all modules. Modules saturates their
|
||||
specified level if it is greater than this option, otherwise they use
|
||||
the level specified by this option instead of their default or
|
||||
whatever was manually set.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, logging is turned off
|
||||
- 1 ERROR, maximal level set to LOG_LEVEL_ERR
|
||||
- 2 WARNING, maximal level set to LOG_LEVEL_WRN
|
||||
- 3 INFO, maximal level set to LOG_LEVEL_INFO
|
||||
- 4 DEBUG, maximal level set to LOG_LEVEL_DBG
|
||||
|
||||
config LOG_MIPI_SYST_ENABLE
|
||||
bool "Enable mipi syst format output"
|
||||
select MIPI_SYST_LIB
|
||||
help
|
||||
Enable mipi syst format output for the logger system.
|
||||
rsource "Kconfig.filtering"
|
||||
|
||||
if !LOG_MINIMAL
|
||||
|
||||
menu "Prepend non-hexdump log message with function name"
|
||||
depends on !LOG_FRONTEND
|
||||
if !LOG_FRONTEND
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_ERR
|
||||
bool "Error messages prepended"
|
||||
rsource "Kconfig.formatting"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_WRN
|
||||
bool "Warning messages prepended"
|
||||
rsource "Kconfig.processing"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_INF
|
||||
bool "Info messages prepended"
|
||||
rsource "Kconfig.backends"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_DBG
|
||||
bool "Debug messages prepended"
|
||||
default y
|
||||
endif # !LOG_FRONTEND
|
||||
|
||||
endmenu
|
||||
|
||||
config LOG_PRINTK
|
||||
bool "Enable processing of printk messages."
|
||||
help
|
||||
LOG_PRINTK messages are formatted in place and logged unconditionally.
|
||||
|
||||
config LOG_PRINTK_MAX_STRING_LENGTH
|
||||
int "Maximum string length supported by LOG_PRINTK"
|
||||
depends on LOG_PRINTK
|
||||
depends on (!LOG_IMMEDIATE || USERSPACE)
|
||||
default 128
|
||||
help
|
||||
Array is allocated on the stack.
|
||||
|
||||
config LOG_IMMEDIATE
|
||||
bool "Enable synchronous processing"
|
||||
help
|
||||
When enabled log is processed in the context of the call. It impacts
|
||||
performance of the system since time consuming operations are
|
||||
performed in the context of the log entry (e.g. high priority
|
||||
interrupt).Logger backends must support exclusive access to work
|
||||
flawlessly in that mode because one log operation can be interrupted
|
||||
by another one in the higher priority context.
|
||||
|
||||
config LOG_IMMEDIATE_CLEAN_OUTPUT
|
||||
bool "Enable clean log output"
|
||||
depends on LOG_IMMEDIATE
|
||||
help
|
||||
If enabled, interrupts are locked during whole log message processing.
|
||||
As a result, processing on one log message cannot be interrupted by
|
||||
another one and output is clean, not interleaved. However, enabling
|
||||
this option is causing interrupts locking for significant amount of
|
||||
time (up to multiple milliseconds).
|
||||
|
||||
config LOG_ENABLE_FANCY_OUTPUT_FORMATTING
|
||||
depends on MINIMAL_LIBC
|
||||
bool "Format strings with minimal libc _prf() instead of _vprintk()"
|
||||
help
|
||||
Selecting this option will choose more robust _prf() function from
|
||||
minimal libc for handling format strings instead of the _vprintk()
|
||||
function. Choosing this option adds around ~3K flash and ~250 bytes on
|
||||
stack.
|
||||
|
||||
if !LOG_IMMEDIATE
|
||||
|
||||
choice
|
||||
prompt "Log full strategy"
|
||||
|
||||
config LOG_MODE_OVERFLOW
|
||||
bool "Oldest logs are discarded"
|
||||
|
||||
config LOG_MODE_NO_OVERFLOW
|
||||
bool "New logs are dropped"
|
||||
|
||||
endchoice
|
||||
|
||||
config LOG_BLOCK_IN_THREAD
|
||||
bool "On log full block in thread context"
|
||||
help
|
||||
When enabled logger will block (if in the thread context) when
|
||||
internal logger buffer is full and new message cannot be allocated.
|
||||
|
||||
config LOG_BLOCK_IN_THREAD_TIMEOUT_MS
|
||||
int "Maximum time (in milliseconds) thread can be blocked"
|
||||
default 1000
|
||||
range -1 10000
|
||||
depends on LOG_BLOCK_IN_THREAD
|
||||
help
|
||||
If new buffer for a log message cannot be allocated in that time, log
|
||||
message is dropped. Forever blocking (-1) is possible however may lead
|
||||
to the logger deadlock if logging is enabled in threads used for
|
||||
logging (e.g. logger or shell thread).
|
||||
|
||||
config LOG_PROCESS_TRIGGER_THRESHOLD
|
||||
int "Amount of buffered logs which triggers processing thread."
|
||||
default 10
|
||||
help
|
||||
When number of buffered messages reaches the threshold thread is waken
|
||||
up. Log processing thread ID is provided during log initialization.
|
||||
Set 0 to disable the feature. If LOG_PROCESS_THREAD is enabled then
|
||||
this threshold is used by the internal thread.
|
||||
|
||||
config LOG_PROCESS_THREAD
|
||||
bool "Enable internal thread for log processing"
|
||||
depends on MULTITHREADING
|
||||
default y
|
||||
help
|
||||
When enabled thread is created by the logger subsystem. Thread is
|
||||
waken up periodically (see LOG_PROCESS_THREAD_SLEEP_MS) and whenever
|
||||
number of buffered messages exceeds the threshold (see
|
||||
LOG_PROCESS_TRIGGER_THR).
|
||||
|
||||
if LOG_PROCESS_THREAD
|
||||
|
||||
config LOG_PROCESS_THREAD_SLEEP_MS
|
||||
int "Set internal log processing thread sleep period"
|
||||
default 1000
|
||||
help
|
||||
Log processing thread sleeps for requested period given in
|
||||
milliseconds. When waken up, thread process any buffered messages.
|
||||
|
||||
config LOG_PROCESS_THREAD_STACK_SIZE
|
||||
int "Stack size for the internal log processing thread"
|
||||
default 2048 if COVERAGE_GCOV
|
||||
default 1024 if NO_OPTIMIZATIONS
|
||||
default 1024 if XTENSA
|
||||
default 4096 if (X86 && X86_64)
|
||||
default 4096 if ARM64
|
||||
default 4096 if SPARC
|
||||
default 2048 if (RISCV && 64BIT)
|
||||
default 768
|
||||
help
|
||||
Set the internal stack size for log processing thread.
|
||||
|
||||
endif # LOG_PROCESS_THREAD
|
||||
|
||||
config LOG_BUFFER_SIZE
|
||||
int "Number of bytes dedicated for the logger internal buffer."
|
||||
default 1024
|
||||
range 128 65536
|
||||
help
|
||||
Number of bytes dedicated for the logger internal buffer.
|
||||
|
||||
config LOG_DETECT_MISSED_STRDUP
|
||||
bool "Detect missed handling of transient strings"
|
||||
default y if !LOG_IMMEDIATE
|
||||
help
|
||||
If enabled, logger will assert and log error message is it detects
|
||||
that string format specifier (%s) and string address which is not from
|
||||
read only memory section and not from pool used for string duplicates.
|
||||
String argument must be duplicated in that case using log_strdup().
|
||||
Detection is performed during log processing thus it does not impact
|
||||
logging timing.
|
||||
|
||||
config LOG_STRDUP_MAX_STRING
|
||||
int "Longest string that can be duplicated using log_strdup()"
|
||||
default 46 if NETWORKING
|
||||
default 32
|
||||
help
|
||||
Longer strings are truncated.
|
||||
|
||||
config LOG_STRDUP_BUF_COUNT
|
||||
int "Number of buffers in the pool used by log_strdup()"
|
||||
default 4
|
||||
help
|
||||
Number of calls to log_strdup() which can be pending before flushed
|
||||
to output. If "<log_strdup alloc failed>" message is seen in the log
|
||||
output, it means this value is too small and should be increased.
|
||||
Each entry takes CONFIG_LOG_STRDUP_MAX_STRING bytes of memory plus
|
||||
some additional fixed overhead.
|
||||
|
||||
config LOG_STRDUP_POOL_PROFILING
|
||||
bool "Enable profiling of pool used for log_strdup()"
|
||||
help
|
||||
When enabled, maximal utilization of the pool is tracked. It can
|
||||
be read out using shell command.
|
||||
|
||||
endif # !LOG_IMMEDIATE
|
||||
|
||||
config LOG_DOMAIN_ID
|
||||
int "Domain ID"
|
||||
default 0
|
||||
range 0 7
|
||||
help
|
||||
In multicore system each application/core must have unique domain ID.
|
||||
|
||||
config LOG_CMDS
|
||||
bool "Enable shell commands"
|
||||
depends on SHELL
|
||||
default y if SHELL
|
||||
|
||||
config LOG_FRONTEND
|
||||
bool "Enable frontend"
|
||||
select LOG_IMMEDIATE
|
||||
help
|
||||
When enabled, logs are redirected to a custom frontend instead
|
||||
of being processed by the logger.
|
||||
|
||||
config LOG_BACKEND_UART
|
||||
bool "Enable UART backend"
|
||||
depends on UART_CONSOLE
|
||||
default y if !SHELL_BACKEND_SERIAL
|
||||
help
|
||||
When enabled backend is using UART to output logs.
|
||||
|
||||
config LOG_BACKEND_UART_SYST_ENABLE
|
||||
bool "Enable UART syst backend"
|
||||
depends on LOG_BACKEND_UART
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using UART to output syst format logs.
|
||||
|
||||
config LOG_BACKEND_SWO
|
||||
bool "Enable Serial Wire Output (SWO) backend"
|
||||
depends on HAS_SWO
|
||||
help
|
||||
When enabled, backend will use SWO for logging.
|
||||
|
||||
if LOG_BACKEND_SWO
|
||||
|
||||
config LOG_BACKEND_SWO_FREQ_HZ
|
||||
int "Set SWO output frequency"
|
||||
default 0
|
||||
help
|
||||
Set SWO output frequency. Value 0 will select maximum frequency
|
||||
supported by the given MCU. Not all debug probes support high
|
||||
frequency SWO operation. In this case the frequency has to be set
|
||||
manually.
|
||||
|
||||
SWO value defined by this option will be configured at boot. Most SWO
|
||||
viewer programs will configure SWO frequency when attached to the
|
||||
debug probe. Such configuration will persist only until the device
|
||||
reset. To ensure flawless operation the frequency configured here and
|
||||
by the SWO viewer program has to match.
|
||||
|
||||
config LOG_BACKEND_SWO_SYST_ENABLE
|
||||
bool "Enable SWO syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using SWO to output syst format logs.
|
||||
|
||||
endif # LOG_BACKEND_SWO
|
||||
|
||||
config LOG_BACKEND_RTT
|
||||
bool "Enable Segger J-Link RTT backend"
|
||||
depends on USE_SEGGER_RTT
|
||||
default y if !SHELL_BACKEND_RTT
|
||||
help
|
||||
When enabled, backend will use RTT for logging. This backend works on a per
|
||||
message basis. Only a whole message (terminated with a carriage return: '\r')
|
||||
is transferred to up-buffer at once depending on available space and
|
||||
selected mode.
|
||||
In panic mode backend always blocks and waits until there is space
|
||||
in up-buffer for a message and message is transferred to host.
|
||||
|
||||
if LOG_BACKEND_RTT
|
||||
|
||||
choice
|
||||
prompt "Logger behavior"
|
||||
default LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_MODE_DROP
|
||||
bool "Drop messages that do not fit in up-buffer."
|
||||
help
|
||||
If there is not enough space in up-buffer for a message, drop it.
|
||||
Number of dropped messages will be logged.
|
||||
Increase up-buffer size helps to reduce dropping of messages.
|
||||
|
||||
config LOG_BACKEND_RTT_MODE_BLOCK
|
||||
bool "Block until message is transferred to host."
|
||||
help
|
||||
Waits until there is enough space in the up-buffer for a message.
|
||||
|
||||
config LOG_BACKEND_RTT_SYST_ENABLE
|
||||
bool "Enable RTT syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using RTT to output syst format logs.
|
||||
|
||||
endchoice
|
||||
|
||||
config LOG_BACKEND_RTT_MESSAGE_SIZE
|
||||
int "Size of internal buffer for storing messages."
|
||||
range 32 256
|
||||
default 128
|
||||
depends on LOG_BACKEND_RTT_MODE_DROP
|
||||
help
|
||||
This option defines maximum message size transferable to up-buffer.
|
||||
|
||||
if LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
|
||||
int "Size of the output buffer"
|
||||
default 16
|
||||
help
|
||||
Buffer is used by log_output module for preparing output data (e.g.
|
||||
string formatting).
|
||||
|
||||
config LOG_BACKEND_RTT_RETRY_CNT
|
||||
int "Number of retries"
|
||||
default 4
|
||||
help
|
||||
Number of TX retries before dropping the data and assuming that
|
||||
RTT session is inactive.
|
||||
|
||||
config LOG_BACKEND_RTT_RETRY_DELAY_MS
|
||||
int "Delay between TX retries in milliseconds"
|
||||
default 5
|
||||
help
|
||||
Sleep period between TX retry attempts. During RTT session, host pulls
|
||||
data periodically. Period starts from 1-2 milliseconds and can be
|
||||
increased if traffic on RTT increases (also from host to device). In
|
||||
case of heavy traffic data can be lost and it may be necessary to
|
||||
increase delay or number of retries.
|
||||
|
||||
endif # LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_BUFFER
|
||||
int "Buffer number used for logger output."
|
||||
range 0 SEGGER_RTT_MAX_NUM_UP_BUFFERS
|
||||
default 0
|
||||
help
|
||||
Select index of up-buffer used for logger output, by default it uses
|
||||
terminal up-buffer and its settings.
|
||||
|
||||
config LOG_BACKEND_RTT_BUFFER_SIZE
|
||||
int "Size of reserved up-buffer for logger output."
|
||||
default 1024
|
||||
depends on LOG_BACKEND_RTT_BUFFER > 0
|
||||
help
|
||||
Specify reserved size of up-buffer used for logger output.
|
||||
|
||||
# Enable processing of printk calls using log if terminal buffer is used.
|
||||
# Same buffer is used by RTT console. If printk would go through RTT console
|
||||
# that will lead to corruption of RTT data which is not protected against being
|
||||
# interrupted by an interrupt.
|
||||
config LOG_BACKEND_RTT_FORCE_PRINTK
|
||||
bool
|
||||
default y if LOG_BACKEND_RTT_BUFFER = 0 && RTT_CONSOLE
|
||||
select LOG_PRINTK
|
||||
|
||||
endif # LOG_BACKEND_RTT
|
||||
|
||||
config LOG_BACKEND_SPINEL
|
||||
bool "Enable OpenThread dedicated Spinel protocol backend"
|
||||
depends on (OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME!=UART_CONSOLE_ON_DEV_NAME || !LOG_BACKEND_UART)
|
||||
depends on NET_L2_OPENTHREAD
|
||||
help
|
||||
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.
|
||||
This protocol is byte oriented and wrapps given messages into serial frames.
|
||||
Backend should be enabled only to OpenThread purposes and when UART backend is disabled
|
||||
or works on antoher UART device to avoid interference.
|
||||
|
||||
if LOG_BACKEND_SPINEL
|
||||
|
||||
config LOG_BACKEND_SPINEL_BUFFER_SIZE
|
||||
int "Size of reserved up-buffer for logger output."
|
||||
default 64
|
||||
help
|
||||
Specify reserved size of up-buffer used for logger output.
|
||||
|
||||
endif # LOG_BACKEND_SPINEL
|
||||
|
||||
config LOG_BACKEND_NATIVE_POSIX
|
||||
bool "Enable native backend"
|
||||
depends on ARCH_POSIX
|
||||
help
|
||||
Enable backend in native_posix
|
||||
|
||||
config LOG_BACKEND_XTENSA_SIM
|
||||
bool "Enable xtensa simulator backend"
|
||||
depends on SOC_XTENSA_SAMPLE_CONTROLLER || SOC_FAMILY_INTEL_ADSP
|
||||
help
|
||||
Enable backend in xtensa simulator
|
||||
|
||||
config LOG_BACKEND_XTENSA_OUTPUT_BUFFER_SIZE
|
||||
int "Size of the output buffer"
|
||||
default 16
|
||||
depends on LOG_BACKEND_XTENSA_SIM
|
||||
help
|
||||
Buffer is used by log_output module for preparing output data (e.g.
|
||||
string formatting).
|
||||
|
||||
# Immediate mode cannot be used with network backend as it would cause the sent
|
||||
# rsyslog message to be malformed.
|
||||
config LOG_BACKEND_NET
|
||||
bool "Enable networking backend"
|
||||
depends on NETWORKING && NET_UDP && !LOG_IMMEDIATE
|
||||
select NET_CONTEXT_NET_PKT_POOL
|
||||
help
|
||||
Send syslog messages to network server.
|
||||
See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP)
|
||||
specifications for details.
|
||||
|
||||
if LOG_BACKEND_NET
|
||||
|
||||
config LOG_BACKEND_NET_SERVER
|
||||
string "Syslog server IP address"
|
||||
help
|
||||
This can be either IPv4 or IPv6 address.
|
||||
Server listen UDP port number can be configured here too.
|
||||
Following syntax is supported:
|
||||
192.0.2.1:514
|
||||
192.0.2.42
|
||||
[2001:db8::1]:514
|
||||
[2001:db8::2]
|
||||
2001:db::42
|
||||
|
||||
config LOG_BACKEND_NET_MAX_BUF
|
||||
int "How many network buffers to allocate for sending messages"
|
||||
range 3 256
|
||||
default 3
|
||||
help
|
||||
Each syslog message should fit into a network packet that will be
|
||||
sent to server. This number tells how many syslog messages can be
|
||||
in transit to the server.
|
||||
|
||||
config LOG_BACKEND_NET_MAX_BUF_SIZE
|
||||
int "Max syslog message size"
|
||||
range 64 1180
|
||||
default 1180 if NET_IPV6
|
||||
default 480 if NET_IPV4
|
||||
default 256
|
||||
help
|
||||
As each syslog message needs to fit to UDP packet, set this value
|
||||
so that messages are not truncated.
|
||||
The RFC 5426 recommends that for IPv4 the size is 480 octets and for
|
||||
IPv6 the size is 1180 octets. As each buffer will use RAM, the value
|
||||
should be selected so that typical messages will fit the buffer.
|
||||
|
||||
config LOG_BACKEND_NET_SYST_ENABLE
|
||||
bool "Enable networking syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using networking to output syst format logs.
|
||||
|
||||
config LOG_BACKEND_NET_AUTOSTART
|
||||
bool "Automatically start networking backend"
|
||||
default y if NET_CONFIG_NEED_IPV4 || NET_CONFIG_NEED_IPV6
|
||||
help
|
||||
When enabled automatically start the networking backend on
|
||||
application start. If no routes to the logging server are available
|
||||
on application startup, this must be set to n and the backend must be
|
||||
started by the application later on. Otherwise the logging
|
||||
thread might block.
|
||||
|
||||
endif # LOG_BACKEND_NET
|
||||
|
||||
config LOG_BACKEND_ADSP
|
||||
bool "Enable Intel ADSP buffer backend"
|
||||
depends on SOC_FAMILY_INTEL_ADSP
|
||||
help
|
||||
Enable backend for the host trace protocol of the Intel ADSP
|
||||
family of audio processors
|
||||
|
||||
config LOG_BACKEND_SHOW_COLOR
|
||||
bool "Enable colors in the backend"
|
||||
depends on LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \
|
||||
|| LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM
|
||||
default y
|
||||
help
|
||||
When enabled selected backend prints errors in red and warning in yellow.
|
||||
|
||||
config LOG_BACKEND_FORMAT_TIMESTAMP
|
||||
bool "Enable timestamp formatting in the backend"
|
||||
depends on LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \
|
||||
|| LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM
|
||||
default y
|
||||
help
|
||||
When enabled timestamp is formatted to hh:mm:ss:ms,us.
|
||||
rsource "Kconfig.misc"
|
||||
|
||||
endif # LOG_MINIMAL
|
||||
endif # LOG
|
||||
|
|
263
subsys/logging/Kconfig.backends
Normal file
263
subsys/logging/Kconfig.backends
Normal file
|
@ -0,0 +1,263 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menu "Backends"
|
||||
|
||||
config LOG_BACKEND_UART
|
||||
bool "Enable UART backend"
|
||||
depends on UART_CONSOLE
|
||||
default y if !SHELL_BACKEND_SERIAL
|
||||
help
|
||||
When enabled backend is using UART to output logs.
|
||||
|
||||
config LOG_BACKEND_UART_SYST_ENABLE
|
||||
bool "Enable UART syst backend"
|
||||
depends on LOG_BACKEND_UART
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using UART to output syst format logs.
|
||||
|
||||
config LOG_BACKEND_SWO
|
||||
bool "Enable Serial Wire Output (SWO) backend"
|
||||
depends on HAS_SWO
|
||||
help
|
||||
When enabled, backend will use SWO for logging.
|
||||
|
||||
if LOG_BACKEND_SWO
|
||||
|
||||
config LOG_BACKEND_SWO_FREQ_HZ
|
||||
int "Set SWO output frequency"
|
||||
default 0
|
||||
help
|
||||
Set SWO output frequency. Value 0 will select maximum frequency
|
||||
supported by the given MCU. Not all debug probes support high
|
||||
frequency SWO operation. In this case the frequency has to be set
|
||||
manually.
|
||||
|
||||
SWO value defined by this option will be configured at boot. Most SWO
|
||||
viewer programs will configure SWO frequency when attached to the
|
||||
debug probe. Such configuration will persist only until the device
|
||||
reset. To ensure flawless operation the frequency configured here and
|
||||
by the SWO viewer program has to match.
|
||||
|
||||
config LOG_BACKEND_SWO_SYST_ENABLE
|
||||
bool "Enable SWO syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using SWO to output syst format logs.
|
||||
|
||||
endif # LOG_BACKEND_SWO
|
||||
|
||||
config LOG_BACKEND_RTT
|
||||
bool "Enable Segger J-Link RTT backend"
|
||||
depends on USE_SEGGER_RTT
|
||||
default y if !SHELL_BACKEND_RTT
|
||||
help
|
||||
When enabled, backend will use RTT for logging. This backend works on a per
|
||||
message basis. Only a whole message (terminated with a carriage return: '\r')
|
||||
is transferred to up-buffer at once depending on available space and
|
||||
selected mode.
|
||||
In panic mode backend always blocks and waits until there is space
|
||||
in up-buffer for a message and message is transferred to host.
|
||||
|
||||
if LOG_BACKEND_RTT
|
||||
|
||||
choice
|
||||
prompt "Logger behavior"
|
||||
default LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_MODE_DROP
|
||||
bool "Drop messages that do not fit in up-buffer."
|
||||
help
|
||||
If there is not enough space in up-buffer for a message, drop it.
|
||||
Number of dropped messages will be logged.
|
||||
Increase up-buffer size helps to reduce dropping of messages.
|
||||
|
||||
config LOG_BACKEND_RTT_MODE_BLOCK
|
||||
bool "Block until message is transferred to host."
|
||||
help
|
||||
Waits until there is enough space in the up-buffer for a message.
|
||||
|
||||
config LOG_BACKEND_RTT_SYST_ENABLE
|
||||
bool "Enable RTT syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using RTT to output syst format logs.
|
||||
|
||||
endchoice
|
||||
|
||||
config LOG_BACKEND_RTT_MESSAGE_SIZE
|
||||
int "Size of internal buffer for storing messages."
|
||||
range 32 256
|
||||
default 128
|
||||
depends on LOG_BACKEND_RTT_MODE_DROP
|
||||
help
|
||||
This option defines maximum message size transferable to up-buffer.
|
||||
|
||||
if LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
|
||||
int "Size of the output buffer"
|
||||
default 16
|
||||
help
|
||||
Buffer is used by log_output module for preparing output data (e.g.
|
||||
string formatting).
|
||||
|
||||
config LOG_BACKEND_RTT_RETRY_CNT
|
||||
int "Number of retries"
|
||||
default 4
|
||||
help
|
||||
Number of TX retries before dropping the data and assuming that
|
||||
RTT session is inactive.
|
||||
|
||||
config LOG_BACKEND_RTT_RETRY_DELAY_MS
|
||||
int "Delay between TX retries in milliseconds"
|
||||
default 5
|
||||
help
|
||||
Sleep period between TX retry attempts. During RTT session, host pulls
|
||||
data periodically. Period starts from 1-2 milliseconds and can be
|
||||
increased if traffic on RTT increases (also from host to device). In
|
||||
case of heavy traffic data can be lost and it may be necessary to
|
||||
increase delay or number of retries.
|
||||
|
||||
endif # LOG_BACKEND_RTT_MODE_BLOCK
|
||||
|
||||
config LOG_BACKEND_RTT_BUFFER
|
||||
int "Buffer number used for logger output."
|
||||
range 0 SEGGER_RTT_MAX_NUM_UP_BUFFERS
|
||||
default 0
|
||||
help
|
||||
Select index of up-buffer used for logger output, by default it uses
|
||||
terminal up-buffer and its settings.
|
||||
|
||||
config LOG_BACKEND_RTT_BUFFER_SIZE
|
||||
int "Size of reserved up-buffer for logger output."
|
||||
default 1024
|
||||
depends on LOG_BACKEND_RTT_BUFFER > 0
|
||||
help
|
||||
Specify reserved size of up-buffer used for logger output.
|
||||
|
||||
# Enable processing of printk calls using log if terminal buffer is used.
|
||||
# Same buffer is used by RTT console. If printk would go through RTT console
|
||||
# that will lead to corruption of RTT data which is not protected against being
|
||||
# interrupted by an interrupt.
|
||||
config LOG_BACKEND_RTT_FORCE_PRINTK
|
||||
bool
|
||||
default y if LOG_BACKEND_RTT_BUFFER = 0 && RTT_CONSOLE
|
||||
select LOG_PRINTK
|
||||
|
||||
endif # LOG_BACKEND_RTT
|
||||
|
||||
config LOG_BACKEND_SPINEL
|
||||
bool "Enable OpenThread dedicated Spinel protocol backend"
|
||||
depends on (OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME!=UART_CONSOLE_ON_DEV_NAME || !LOG_BACKEND_UART)
|
||||
depends on NET_L2_OPENTHREAD
|
||||
help
|
||||
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.
|
||||
This protocol is byte oriented and wrapps given messages into serial frames.
|
||||
Backend should be enabled only to OpenThread purposes and when UART backend is disabled
|
||||
or works on antoher UART device to avoid interference.
|
||||
|
||||
if LOG_BACKEND_SPINEL
|
||||
|
||||
config LOG_BACKEND_SPINEL_BUFFER_SIZE
|
||||
int "Size of reserved up-buffer for logger output."
|
||||
default 64
|
||||
help
|
||||
Specify reserved size of up-buffer used for logger output.
|
||||
|
||||
endif # LOG_BACKEND_SPINEL
|
||||
|
||||
config LOG_BACKEND_NATIVE_POSIX
|
||||
bool "Enable native backend"
|
||||
depends on ARCH_POSIX
|
||||
help
|
||||
Enable backend in native_posix
|
||||
|
||||
config LOG_BACKEND_XTENSA_SIM
|
||||
bool "Enable xtensa simulator backend"
|
||||
depends on SOC_XTENSA_SAMPLE_CONTROLLER || SOC_FAMILY_INTEL_ADSP
|
||||
help
|
||||
Enable backend in xtensa simulator
|
||||
|
||||
config LOG_BACKEND_XTENSA_OUTPUT_BUFFER_SIZE
|
||||
int "Size of the output buffer"
|
||||
default 16
|
||||
depends on LOG_BACKEND_XTENSA_SIM
|
||||
help
|
||||
Buffer is used by log_output module for preparing output data (e.g.
|
||||
string formatting).
|
||||
|
||||
# Immediate mode cannot be used with network backend as it would cause the sent
|
||||
# rsyslog message to be malformed.
|
||||
config LOG_BACKEND_NET
|
||||
bool "Enable networking backend"
|
||||
depends on NETWORKING && NET_UDP && !LOG_IMMEDIATE
|
||||
select NET_CONTEXT_NET_PKT_POOL
|
||||
help
|
||||
Send syslog messages to network server.
|
||||
See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP)
|
||||
specifications for details.
|
||||
|
||||
if LOG_BACKEND_NET
|
||||
|
||||
config LOG_BACKEND_NET_SERVER
|
||||
string "Syslog server IP address"
|
||||
help
|
||||
This can be either IPv4 or IPv6 address.
|
||||
Server listen UDP port number can be configured here too.
|
||||
Following syntax is supported:
|
||||
192.0.2.1:514
|
||||
192.0.2.42
|
||||
[2001:db8::1]:514
|
||||
[2001:db8::2]
|
||||
2001:db::42
|
||||
|
||||
config LOG_BACKEND_NET_MAX_BUF
|
||||
int "How many network buffers to allocate for sending messages"
|
||||
range 3 256
|
||||
default 3
|
||||
help
|
||||
Each syslog message should fit into a network packet that will be
|
||||
sent to server. This number tells how many syslog messages can be
|
||||
in transit to the server.
|
||||
|
||||
config LOG_BACKEND_NET_MAX_BUF_SIZE
|
||||
int "Max syslog message size"
|
||||
range 64 1180
|
||||
default 1180 if NET_IPV6
|
||||
default 480 if NET_IPV4
|
||||
default 256
|
||||
help
|
||||
As each syslog message needs to fit to UDP packet, set this value
|
||||
so that messages are not truncated.
|
||||
The RFC 5426 recommends that for IPv4 the size is 480 octets and for
|
||||
IPv6 the size is 1180 octets. As each buffer will use RAM, the value
|
||||
should be selected so that typical messages will fit the buffer.
|
||||
|
||||
config LOG_BACKEND_NET_SYST_ENABLE
|
||||
bool "Enable networking syst backend"
|
||||
depends on LOG_MIPI_SYST_ENABLE
|
||||
help
|
||||
When enabled backend is using networking to output syst format logs.
|
||||
|
||||
config LOG_BACKEND_NET_AUTOSTART
|
||||
bool "Automatically start networking backend"
|
||||
default y if NET_CONFIG_NEED_IPV4 || NET_CONFIG_NEED_IPV6
|
||||
help
|
||||
When enabled automatically start the networking backend on
|
||||
application start. If no routes to the logging server are available
|
||||
on application startup, this must be set to n and the backend must be
|
||||
started by the application later on. Otherwise the logging
|
||||
thread might block.
|
||||
|
||||
endif # LOG_BACKEND_NET
|
||||
|
||||
config LOG_BACKEND_ADSP
|
||||
bool "Enable Intel ADSP buffer backend"
|
||||
depends on SOC_FAMILY_INTEL_ADSP
|
||||
help
|
||||
Enable backend for the host trace protocol of the Intel ADSP
|
||||
family of audio processors
|
||||
|
||||
endmenu
|
62
subsys/logging/Kconfig.filtering
Normal file
62
subsys/logging/Kconfig.filtering
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menu "Logging levels filtering"
|
||||
|
||||
config LOG_RUNTIME_FILTERING
|
||||
bool "Runtime filtering reconfiguration"
|
||||
depends on !LOG_FRONTEND && !LOG_MINIMAL
|
||||
help
|
||||
Allow runtime configuration of maximal, independent severity
|
||||
level for instance.
|
||||
|
||||
config LOG_DEFAULT_LEVEL
|
||||
int "Default log level"
|
||||
default 3
|
||||
range 0 4
|
||||
help
|
||||
Sets log level for modules which don't specify it explicitly. When
|
||||
set to 0 it means log will not be activated for those modules.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, do not write by default
|
||||
- 1 ERROR, default to only write LOG_LEVEL_ERR
|
||||
- 2 WARNING, default to write LOG_LEVEL_WRN
|
||||
- 3 INFO, default to write LOG_LEVEL_INFO
|
||||
- 4 DEBUG, default to write LOG_LEVEL_DBG
|
||||
|
||||
config LOG_OVERRIDE_LEVEL
|
||||
int "Override lowest log level"
|
||||
default 0
|
||||
range 0 4
|
||||
help
|
||||
Forces a minimum log level for all modules. Modules use their
|
||||
specified level if it is greater than this option, otherwise they use
|
||||
the level specified by this option instead of their default or
|
||||
whatever was manually set.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, do not override
|
||||
- 1 ERROR, override to write LOG_LEVEL_ERR
|
||||
- 2 WARNING, override to write LOG_LEVEL_WRN
|
||||
- 3 INFO, override to write LOG_LEVEL_INFO
|
||||
- 4 DEBUG, override to write LOG_LEVEL_DBG
|
||||
|
||||
config LOG_MAX_LEVEL
|
||||
int "Maximal log level compiled in the system"
|
||||
default 4
|
||||
range 0 4
|
||||
help
|
||||
Forces a maximal log level for all modules. Modules saturates their
|
||||
specified level if it is greater than this option, otherwise they use
|
||||
the level specified by this option instead of their default or
|
||||
whatever was manually set.
|
||||
Levels are:
|
||||
|
||||
- 0 OFF, logging is turned off
|
||||
- 1 ERROR, maximal level set to LOG_LEVEL_ERR
|
||||
- 2 WARNING, maximal level set to LOG_LEVEL_WRN
|
||||
- 3 INFO, maximal level set to LOG_LEVEL_INFO
|
||||
- 4 DEBUG, maximal level set to LOG_LEVEL_DBG
|
||||
|
||||
endmenu
|
56
subsys/logging/Kconfig.formatting
Normal file
56
subsys/logging/Kconfig.formatting
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menu "Output Formatting"
|
||||
|
||||
menu "Prepend non-hexdump log message with function name"
|
||||
depends on !LOG_FRONTEND
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_ERR
|
||||
bool "Error messages prepended"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_WRN
|
||||
bool "Warning messages prepended"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_INF
|
||||
bool "Info messages prepended"
|
||||
|
||||
config LOG_FUNC_NAME_PREFIX_DBG
|
||||
bool "Debug messages prepended"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
config LOG_MIPI_SYST_ENABLE
|
||||
bool "Enable MIPI SyS-T format output"
|
||||
select MIPI_SYST_LIB
|
||||
help
|
||||
Enable MIPI SyS-T format output for the logger system.
|
||||
|
||||
config LOG_IMMEDIATE_CLEAN_OUTPUT
|
||||
bool "Clean log output"
|
||||
depends on LOG_IMMEDIATE
|
||||
help
|
||||
If enabled, interrupts are locked during whole log message processing.
|
||||
As a result, processing on one log message cannot be interrupted by
|
||||
another one and output is clean, not interleaved. However, enabling
|
||||
this option is causing interrupts locking for significant amount of
|
||||
time (up to multiple milliseconds).
|
||||
|
||||
config LOG_BACKEND_SHOW_COLOR
|
||||
bool "Enable colors in the backend"
|
||||
depends on LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \
|
||||
|| LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM
|
||||
default y
|
||||
help
|
||||
When enabled selected backend prints errors in red and warning in yellow.
|
||||
|
||||
config LOG_BACKEND_FORMAT_TIMESTAMP
|
||||
bool "Enable timestamp formatting in the backend"
|
||||
depends on LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \
|
||||
|| LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM
|
||||
default y
|
||||
help
|
||||
When enabled timestamp is formatted to hh:mm:ss:ms,us.
|
||||
|
||||
endmenu
|
19
subsys/logging/Kconfig.misc
Normal file
19
subsys/logging/Kconfig.misc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menu "Misc"
|
||||
|
||||
config LOG_DOMAIN_ID
|
||||
int "Domain ID"
|
||||
default 0
|
||||
range 0 7
|
||||
help
|
||||
In multicore system each application/core must have unique domain ID.
|
||||
|
||||
config LOG_CMDS
|
||||
bool "Enable shell commands"
|
||||
depends on SHELL
|
||||
depends on !LOG_FRONTEND
|
||||
default y if SHELL
|
||||
|
||||
endmenu
|
54
subsys/logging/Kconfig.mode
Normal file
54
subsys/logging/Kconfig.mode
Normal file
|
@ -0,0 +1,54 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
choice
|
||||
prompt "Mode"
|
||||
default LOG_MODE_DEFERRED
|
||||
|
||||
config LOG_MODE_DEFERRED
|
||||
bool "Deferred logging"
|
||||
help
|
||||
Log messages are buffered and processed later. This mode has the
|
||||
least impact on the application. Time consuming processing is
|
||||
deferred to the known context.
|
||||
|
||||
config LOG_MODE_IMMEDIATE
|
||||
bool "Synchronous"
|
||||
help
|
||||
When enabled log is processed in the context of the call. It impacts
|
||||
performance of the system since time consuming operations are
|
||||
performed in the context of the log entry (e.g. high priority
|
||||
interrupt).Logger backends must support exclusive access to work
|
||||
flawlessly in that mode because one log operation can be interrupted
|
||||
by another one in the higher priority context.
|
||||
|
||||
|
||||
config LOG_MODE_MINIMAL
|
||||
bool "Minimal-footprint"
|
||||
imply PRINTK
|
||||
help
|
||||
Enable minimal logging implementation. This has very little footprint
|
||||
overhead on top of the printk() implementation for standard
|
||||
logging macros. Hexdump macros are also supported, with a small
|
||||
amount of code pulled in if used. Build time filtering is supported,
|
||||
but not runtime filtering. There are no timestamps, prefixes,
|
||||
colors, or asynchronous logging, and all messages are simply
|
||||
sent to printk().
|
||||
|
||||
config LOG_FRONTEND
|
||||
bool "Frontend"
|
||||
help
|
||||
When enabled, logs are redirected to a custom frontend instead
|
||||
of being processed by the logger. In this mode runtime filtering and
|
||||
multiple backends are not used.
|
||||
|
||||
endchoice
|
||||
|
||||
config LOG_IMMEDIATE
|
||||
bool
|
||||
default y if LOG_MODE_IMMEDIATE
|
||||
|
||||
config LOG_MINIMAL
|
||||
bool
|
||||
imply PRINTK
|
||||
default y if LOG_MODE_MINIMAL
|
139
subsys/logging/Kconfig.processing
Normal file
139
subsys/logging/Kconfig.processing
Normal file
|
@ -0,0 +1,139 @@
|
|||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menu "Processing"
|
||||
|
||||
if !LOG_MINIMAL
|
||||
|
||||
config LOG_PRINTK
|
||||
bool "Process printk messages"
|
||||
help
|
||||
LOG_PRINTK messages are formatted in place and logged unconditionally.
|
||||
|
||||
config LOG_PRINTK_MAX_STRING_LENGTH
|
||||
int "Maximum string length supported by LOG_PRINTK"
|
||||
depends on LOG_PRINTK
|
||||
depends on (!LOG_IMMEDIATE || USERSPACE)
|
||||
default 128
|
||||
help
|
||||
Array is allocated on the stack.
|
||||
|
||||
if !LOG_IMMEDIATE
|
||||
|
||||
config LOG_MODE_OVERFLOW
|
||||
bool "Drop oldest message when full"
|
||||
default y
|
||||
help
|
||||
If enabled, then if there is no space to log a new message, the
|
||||
oldest one is dropped. If disabled, current message is dropped.
|
||||
|
||||
config LOG_BLOCK_IN_THREAD
|
||||
bool "Block in thread context on full"
|
||||
help
|
||||
When enabled logger will block (if in the thread context) when
|
||||
internal logger buffer is full and new message cannot be allocated.
|
||||
|
||||
config LOG_BLOCK_IN_THREAD_TIMEOUT_MS
|
||||
int "Maximum time (in milliseconds) thread can be blocked"
|
||||
default 1000
|
||||
range -1 10000
|
||||
depends on LOG_BLOCK_IN_THREAD
|
||||
help
|
||||
If new buffer for a log message cannot be allocated in that time, log
|
||||
message is dropped. Forever blocking (-1) is possible however may lead
|
||||
to the logger deadlock if logging is enabled in threads used for
|
||||
logging (e.g. logger or shell thread).
|
||||
|
||||
config LOG_PROCESS_TRIGGER_THRESHOLD
|
||||
int "Number of buffered log messages before flushing"
|
||||
default 10
|
||||
help
|
||||
When number of buffered messages reaches the threshold thread is waken
|
||||
up. Log processing thread ID is provided during log initialization.
|
||||
Set 0 to disable the feature. If LOG_PROCESS_THREAD is enabled then
|
||||
this threshold is used by the internal thread.
|
||||
|
||||
config LOG_PROCESS_THREAD
|
||||
bool "Use internal thread for log processing"
|
||||
depends on MULTITHREADING
|
||||
default y
|
||||
help
|
||||
When enabled thread is created by the logger subsystem. Thread is
|
||||
waken up periodically (see LOG_PROCESS_THREAD_SLEEP_MS) and whenever
|
||||
number of buffered messages exceeds the threshold (see
|
||||
LOG_PROCESS_TRIGGER_THR).
|
||||
|
||||
if LOG_PROCESS_THREAD
|
||||
|
||||
config LOG_PROCESS_THREAD_SLEEP_MS
|
||||
int "Set internal log processing thread sleep period"
|
||||
default 1000
|
||||
help
|
||||
Log processing thread sleeps for requested period given in
|
||||
milliseconds. When waken up, thread process any buffered messages.
|
||||
|
||||
config LOG_PROCESS_THREAD_STACK_SIZE
|
||||
int "Stack size for the internal log processing thread"
|
||||
default 2048 if COVERAGE_GCOV
|
||||
default 1024 if NO_OPTIMIZATIONS
|
||||
default 1024 if XTENSA
|
||||
default 4096 if (X86 && X86_64)
|
||||
default 4096 if ARM64
|
||||
default 4096 if SPARC
|
||||
default 2048 if (RISCV && 64BIT)
|
||||
default 768
|
||||
help
|
||||
Set the internal stack size for log processing thread.
|
||||
|
||||
endif # LOG_PROCESS_THREAD
|
||||
|
||||
config LOG_BUFFER_SIZE
|
||||
int "Number of bytes dedicated for the logger internal buffer"
|
||||
default 1024
|
||||
range 128 65536
|
||||
help
|
||||
Number of bytes dedicated for the logger internal buffer.
|
||||
|
||||
endif # !LOG_IMMEDIATE
|
||||
|
||||
if LOG_MODE_DEFERRED
|
||||
|
||||
config LOG_DETECT_MISSED_STRDUP
|
||||
bool "Detect missed handling of transient strings"
|
||||
default y if !LOG_IMMEDIATE
|
||||
help
|
||||
If enabled, logger will assert and log error message is it detects
|
||||
that string format specifier (%s) and string address which is not from
|
||||
read only memory section and not from pool used for string duplicates.
|
||||
String argument must be duplicated in that case using log_strdup().
|
||||
Detection is performed during log processing thus it does not impact
|
||||
logging timing.
|
||||
|
||||
config LOG_STRDUP_MAX_STRING
|
||||
int "Longest string that can be duplicated using log_strdup()"
|
||||
default 46 if NETWORKING
|
||||
default 32
|
||||
help
|
||||
Longer strings are truncated.
|
||||
|
||||
config LOG_STRDUP_BUF_COUNT
|
||||
int "Number of buffers in the pool used by log_strdup()"
|
||||
default 4
|
||||
help
|
||||
Number of calls to log_strdup() which can be pending before flushed
|
||||
to output. If "<log_strdup alloc failed>" message is seen in the log
|
||||
output, it means this value is too small and should be increased.
|
||||
Each entry takes CONFIG_LOG_STRDUP_MAX_STRING bytes of memory plus
|
||||
some additional fixed overhead.
|
||||
|
||||
config LOG_STRDUP_POOL_PROFILING
|
||||
bool "Enable profiling of pool used for log_strdup()"
|
||||
help
|
||||
When enabled, maximal utilization of the pool is tracked. It can
|
||||
be read out using shell command.
|
||||
|
||||
endif # LOG_MODE_DEFERRED
|
||||
|
||||
endif # !LOG_MINIMAL
|
||||
|
||||
endmenu
|
|
@ -79,7 +79,7 @@ config TEST_LOGGING_DEFAULTS
|
|||
bool "Enable test case logging defaults"
|
||||
depends on TEST
|
||||
select LOG
|
||||
imply LOG_MINIMAL
|
||||
select LOG_MINIMAL
|
||||
default y
|
||||
help
|
||||
Option which implements default policy of enabling logging in
|
||||
|
|
|
@ -2,5 +2,5 @@ CONFIG_HEAP_MEM_POOL_SIZE=256
|
|||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
CONFIG_MP_NUM_CPUS=1
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_THREAD_NAME=y
|
||||
|
|
|
@ -2,7 +2,7 @@ CONFIG_HEAP_MEM_POOL_SIZE=256
|
|||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
CONFIG_MP_NUM_CPUS=1
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_USERSPACE=y
|
||||
CONFIG_DYNAMIC_OBJECTS=y
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_DEBUG_COREDUMP=y
|
||||
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
|
||||
CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_DEBUG_COREDUMP=y
|
||||
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
|
||||
CONFIG_MP_NUM_CPUS=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_TEST_FLASH_DRIVERS=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_LOG_MODE_MINIMAL=y
|
||||
CONFIG_DEBUG_COREDUMP=y
|
||||
CONFIG_DEBUG_COREDUMP_BACKEND_FLASH_PARTITION=y
|
||||
CONFIG_MP_NUM_CPUS=1
|
||||
|
|
|
@ -3,4 +3,4 @@ CONFIG_ZTEST=y
|
|||
CONFIG_TEST_LOGGING_DEFAULTS=n
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_BACKEND_UART=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
|
|
|
@ -2,5 +2,5 @@ CONFIG_MAIN_THREAD_PRIORITY=5
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_TEST_LOGGING_DEFAULTS=n
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_IMMEDIATE=y
|
||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||
CONFIG_ASSERT=y
|
||||
|
|
|
@ -3,4 +3,4 @@ CONFIG_ZTEST=y
|
|||
CONFIG_TEST_LOGGING_DEFAULTS=n
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_PRINTK=n
|
||||
CONFIG_LOG_IMMEDIATE=n
|
||||
CONFIG_LOG_MODE_DEFERRED=y
|
||||
|
|
|
@ -12,7 +12,6 @@ CONFIG_SHELL_CMD_BUFF_SIZE=128
|
|||
CONFIG_CBPRINTF_NANO=y
|
||||
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=n
|
||||
#Shell features:
|
||||
CONFIG_SHELL_LOG_BACKEND=y
|
||||
CONFIG_SHELL_TAB=n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue