507 lines
14 KiB
Plaintext
507 lines
14 KiB
Plaintext
#
|
|
# Copyright (c) 2016 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
menu "Logging Options"
|
|
|
|
config SYS_LOG
|
|
bool "Enable Logging"
|
|
depends on PRINTK
|
|
help
|
|
Global switch for logging, when turned off log calls will not be
|
|
executed.
|
|
|
|
config SYS_LOG_SHOW_TAGS
|
|
bool "Prepend level tags to logs"
|
|
depends on SYS_LOG
|
|
default y
|
|
help
|
|
Prefixes all log lines with an identifier to the log level submitted in
|
|
the C code.
|
|
|
|
config SYS_LOG_SHOW_COLOR
|
|
bool "Use colored logs"
|
|
depends on SYS_LOG
|
|
help
|
|
Use color in the logs. This requires an ANSI capable terminal.
|
|
|
|
config SYS_LOG_DEFAULT_LEVEL
|
|
int "Default log level"
|
|
depends on SYS_LOG
|
|
default 0
|
|
range 0 4
|
|
help
|
|
Sets log level for modules which don't specify it explicitly. When
|
|
set to 0 it means log wont be activated for those modules.
|
|
Levels are:
|
|
0 OFF, do not write by default
|
|
1 ERROR, default to only write SYS_LOG_ERR
|
|
2 WARNING, default to write SYS_LOG_WRN in addition to previous level
|
|
3 INFO, default to write SYS_LOG_INF in addition to previous levels
|
|
4 DEBUG, default to write SYS_LOG_DBG in addition to previous levels
|
|
|
|
config SYS_LOG_OVERRIDE_LEVEL
|
|
int "Override lowest log level"
|
|
depends on SYS_LOG
|
|
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 SYS_LOG_ERR
|
|
2 WARNING, override to write SYS_LOG_WRN in addition to previous level
|
|
3 INFO, override to write SYS_LOG_INF in addition to previous levels
|
|
4 DEBUG, override to write SYS_LOG_DBG in addition to previous levels
|
|
|
|
config SYS_LOG_EXT_HOOK
|
|
bool "Use external hook function for logging"
|
|
depends on SYS_LOG
|
|
help
|
|
Use external hook function for logging.
|
|
|
|
config SYS_LOG_BACKEND_NET
|
|
bool "Networking syslog backend"
|
|
depends on SYS_LOG && NETWORKING
|
|
select SYS_LOG_EXT_HOOK
|
|
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 SYS_LOG_BACKEND_NET
|
|
|
|
config SYS_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 SYS_LOG_BACKEND_NET_MAX_BUF
|
|
int "How many network buffers to allocate for sending messages"
|
|
range 3 256
|
|
default 3
|
|
help
|
|
Each syslog message will occupy one network buffer.
|
|
|
|
config SYS_LOG_BACKEND_NET_MAX_BUF_SIZE
|
|
int "Max syslog message size"
|
|
range 64 1180
|
|
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.
|
|
The total allocated memory will be
|
|
SYS_LOG_BACKEND_NET_MAX_BUF * SYS_LOG_BACKEND_NET_MAX_BUF_SIZE
|
|
|
|
endif
|
|
|
|
config LOG
|
|
bool "Enable Logger"
|
|
help
|
|
Global switch for the logger, when turned off log calls will not be
|
|
compiled in.
|
|
|
|
if LOG
|
|
config LOG_RUNTIME_FILTERING
|
|
bool "Enable runtime reconfiguration of the logger"
|
|
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
|
|
|
|
menu "Prepend log message with function name"
|
|
|
|
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_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
|
|
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_DISABLE_FANCY_OUTPUT_FORMATTING
|
|
depends on !NEWLIB_LIBC && !ARCH_POSIX
|
|
bool "Use vprintk() instead of minimal libc _prf()"
|
|
help
|
|
Selecting this option will choose vprintk for handling format
|
|
strings instead of the more robust _prf() function in minimal
|
|
libc. Choosing this option can save around ~3K flash.
|
|
|
|
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_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 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_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.
|
|
|
|
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_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_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.
|
|
|
|
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.
|
|
|
|
endchoice
|
|
|
|
if LOG_BACKEND_RTT_MODE_DROP
|
|
|
|
config LOG_BACKEND_RTT_MESSAGE_SIZE
|
|
int "Size of internal buffer for storing messages."
|
|
range 32 256
|
|
default 128
|
|
help
|
|
This option defines maximum message size transferable to up-buffer.
|
|
|
|
endif #LOG_BACKEND_RTT_MODE_DROP
|
|
|
|
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.
|
|
|
|
if LOG_BACKEND_RTT_BUFFER > 0
|
|
|
|
config LOG_BACKEND_RTT_BUFFER_SIZE
|
|
int "Size of reserved up-buffer for logger output."
|
|
default 1024
|
|
help
|
|
Specify reserved size of up-buffer used for logger output.
|
|
|
|
endif # LOG_BACKEND_RTT_BUFFER
|
|
endif # LOG_BACKEND_RTT
|
|
|
|
config LOG_BACKEND_NATIVE_POSIX
|
|
bool "Enable native backend"
|
|
depends on ARCH_POSIX
|
|
default n
|
|
help
|
|
Enable backend in native_posix
|
|
|
|
config LOG_BACKEND_NET
|
|
bool "Enable networking backend"
|
|
depends on NETWORKING
|
|
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.
|
|
|
|
endif # LOG_BACKEND_NET
|
|
|
|
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
|
|
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
|
|
default y
|
|
help
|
|
When enabled timestamp is formatted to hh:mm:ss:ms,us.
|
|
|
|
endif
|
|
endmenu
|