logging: Allow for compilation without log_output
Add option to Kconfig to enable log_output module. It is used by most of the backends but it is an optional formatter helper thus it is possible to run logging without it. One example might be dictionary based logging which does not format log message to a readable string. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
33eba217de
commit
e4bd0fceef
7 changed files with 34 additions and 4 deletions
|
@ -9,6 +9,11 @@ if(NOT CONFIG_LOG_MODE_MINIMAL)
|
||||||
log_output.c
|
log_output.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
zephyr_sources_ifdef(
|
||||||
|
CONFIG_LOG_OUTPUT
|
||||||
|
log_output.c
|
||||||
|
)
|
||||||
|
|
||||||
# Determine if __auto_type is supported. If not then runtime approach must always
|
# Determine if __auto_type is supported. If not then runtime approach must always
|
||||||
# be used.
|
# be used.
|
||||||
# Supported by:
|
# Supported by:
|
||||||
|
|
|
@ -16,13 +16,17 @@ rsource "Kconfig.filtering"
|
||||||
|
|
||||||
rsource "Kconfig.processing"
|
rsource "Kconfig.processing"
|
||||||
|
|
||||||
if !LOG_FRONTEND_ONLY && !LOG_MODE_MINIMAL
|
if !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
rsource "Kconfig.formatting"
|
rsource "Kconfig.formatting"
|
||||||
|
|
||||||
|
if !LOG_FRONTEND_ONLY
|
||||||
|
|
||||||
rsource "Kconfig.backends"
|
rsource "Kconfig.backends"
|
||||||
|
|
||||||
endif # !LOG_FRONTEND_ONLY && !LOG_MODE_MINIMAL
|
endif # !LOG_FRONTEND_ONLY
|
||||||
|
|
||||||
|
endif # !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
if LOG_FRONTEND
|
if LOG_FRONTEND
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ config LOG_BACKEND_UART
|
||||||
bool "UART backend"
|
bool "UART backend"
|
||||||
depends on UART_CONSOLE
|
depends on UART_CONSOLE
|
||||||
default y if !SHELL_BACKEND_SERIAL
|
default y if !SHELL_BACKEND_SERIAL
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
When enabled backend is using UART to output logs.
|
When enabled backend is using UART to output logs.
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ endif # LOG_BACKEND_UART
|
||||||
config LOG_BACKEND_SWO
|
config LOG_BACKEND_SWO
|
||||||
bool "Serial Wire Output (SWO) backend"
|
bool "Serial Wire Output (SWO) backend"
|
||||||
depends on HAS_SWO
|
depends on HAS_SWO
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
When enabled, backend will use SWO for logging.
|
When enabled, backend will use SWO for logging.
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ config LOG_BACKEND_RTT
|
||||||
depends on USE_SEGGER_RTT
|
depends on USE_SEGGER_RTT
|
||||||
default y if !SHELL_BACKEND_RTT
|
default y if !SHELL_BACKEND_RTT
|
||||||
select SEGGER_RTT_CUSTOM_LOCKING
|
select SEGGER_RTT_CUSTOM_LOCKING
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
When enabled, backend will use RTT for logging. This backend works on a per
|
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')
|
message basis. Only a whole message (terminated with a carriage return: '\r')
|
||||||
|
@ -189,6 +192,7 @@ config LOG_BACKEND_SPINEL
|
||||||
bool "OpenThread dedicated Spinel protocol backend"
|
bool "OpenThread dedicated Spinel protocol backend"
|
||||||
depends on !LOG_BACKEND_UART
|
depends on !LOG_BACKEND_UART
|
||||||
depends on NET_L2_OPENTHREAD
|
depends on NET_L2_OPENTHREAD
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.
|
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.
|
||||||
This protocol is byte oriented and wraps given messages into serial frames.
|
This protocol is byte oriented and wraps given messages into serial frames.
|
||||||
|
@ -213,6 +217,7 @@ config LOG_BACKEND_NATIVE_POSIX
|
||||||
bool "Native backend"
|
bool "Native backend"
|
||||||
depends on ARCH_POSIX
|
depends on ARCH_POSIX
|
||||||
default y if !SERIAL
|
default y if !SERIAL
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
Enable backend in native_posix
|
Enable backend in native_posix
|
||||||
|
|
||||||
|
@ -228,6 +233,7 @@ config LOG_BACKEND_XTENSA_SIM
|
||||||
bool "Xtensa simulator backend"
|
bool "Xtensa simulator backend"
|
||||||
depends on SOC_XTENSA_SAMPLE_CONTROLLER || SOC_FAMILY_INTEL_ADSP
|
depends on SOC_XTENSA_SAMPLE_CONTROLLER || SOC_FAMILY_INTEL_ADSP
|
||||||
default y if SOC_XTENSA_SAMPLE_CONTROLLER
|
default y if SOC_XTENSA_SAMPLE_CONTROLLER
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
Enable backend in xtensa simulator
|
Enable backend in xtensa simulator
|
||||||
|
|
||||||
|
@ -253,6 +259,7 @@ config LOG_BACKEND_NET
|
||||||
bool "Networking backend"
|
bool "Networking backend"
|
||||||
depends on NETWORKING && NET_UDP && !LOG_MODE_IMMEDIATE
|
depends on NETWORKING && NET_UDP && !LOG_MODE_IMMEDIATE
|
||||||
select NET_CONTEXT_NET_PKT_POOL
|
select NET_CONTEXT_NET_PKT_POOL
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
Send syslog messages to network server.
|
Send syslog messages to network server.
|
||||||
See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP)
|
See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP)
|
||||||
|
@ -313,6 +320,7 @@ endif # LOG_BACKEND_NET
|
||||||
config LOG_BACKEND_ADSP
|
config LOG_BACKEND_ADSP
|
||||||
bool "Intel ADSP buffer backend"
|
bool "Intel ADSP buffer backend"
|
||||||
depends on SOC_FAMILY_INTEL_ADSP
|
depends on SOC_FAMILY_INTEL_ADSP
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
Enable backend for the host trace protocol of the Intel ADSP
|
Enable backend for the host trace protocol of the Intel ADSP
|
||||||
family of audio processors
|
family of audio processors
|
||||||
|
@ -328,6 +336,7 @@ endif # LOG_BACKEND_ADSP
|
||||||
config LOG_BACKEND_CAVS_HDA
|
config LOG_BACKEND_CAVS_HDA
|
||||||
bool "cAVS HDA backend"
|
bool "cAVS HDA backend"
|
||||||
depends on SOC_FAMILY_INTEL_ADSP && DMA && DMA_CAVS_HDA
|
depends on SOC_FAMILY_INTEL_ADSP && DMA && DMA_CAVS_HDA
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
Provide a logging backend which writes to a buffer and
|
Provide a logging backend which writes to a buffer and
|
||||||
periodically flushes to hardware using ringbuffer like
|
periodically flushes to hardware using ringbuffer like
|
||||||
|
@ -363,6 +372,7 @@ endif # LOG_BACKEND_CAVS_HDA
|
||||||
config LOG_BACKEND_FS
|
config LOG_BACKEND_FS
|
||||||
bool "File system backend"
|
bool "File system backend"
|
||||||
depends on FILE_SYSTEM
|
depends on FILE_SYSTEM
|
||||||
|
select LOG_OUTPUT
|
||||||
help
|
help
|
||||||
When enabled, backend is using the configured file system to output logs.
|
When enabled, backend is using the configured file system to output logs.
|
||||||
As the file system must be mounted for the logging to work, it must be
|
As the file system must be mounted for the logging to work, it must be
|
||||||
|
|
|
@ -21,6 +21,12 @@ config LOG_FUNC_NAME_PREFIX_DBG
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
config LOG_OUTPUT
|
||||||
|
bool "Formatter helper"
|
||||||
|
help
|
||||||
|
Module which provides formatting of log messages to a human-readable
|
||||||
|
strings.
|
||||||
|
|
||||||
menuconfig LOG_MIPI_SYST_ENABLE
|
menuconfig LOG_MIPI_SYST_ENABLE
|
||||||
bool "MIPI SyS-T format output"
|
bool "MIPI SyS-T format output"
|
||||||
select MIPI_SYST_LIB
|
select MIPI_SYST_LIB
|
||||||
|
|
|
@ -54,7 +54,8 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const log_format_func_t format_table[] = {
|
static const log_format_func_t format_table[] = {
|
||||||
[LOG_OUTPUT_TEXT] = log_output_msg_process,
|
[LOG_OUTPUT_TEXT] = IS_ENABLED(CONFIG_LOG_OUTPUT) ?
|
||||||
|
log_output_msg_process : NULL,
|
||||||
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
||||||
log_output_msg_syst_process : NULL,
|
log_output_msg_syst_process : NULL,
|
||||||
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
||||||
|
@ -330,7 +331,9 @@ int log_set_timestamp_func(log_timestamp_get_t timestamp_getter, uint32_t freq)
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp_func = timestamp_getter;
|
timestamp_func = timestamp_getter;
|
||||||
log_output_timestamp_freq_set(freq);
|
if (IS_ENABLED(CONFIG_LOG_OUTPUT)) {
|
||||||
|
log_output_timestamp_freq_set(freq);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,5 @@ CONFIG_MAIN_THREAD_PRIORITY=5
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_TEST_LOGGING_DEFAULTS=n
|
CONFIG_TEST_LOGGING_DEFAULTS=n
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
|
CONFIG_LOG_OUTPUT=y
|
||||||
CONFIG_LOG_PRINTK=n
|
CONFIG_LOG_PRINTK=n
|
||||||
|
|
|
@ -2,6 +2,7 @@ CONFIG_LOG=y
|
||||||
CONFIG_ASSERT=n
|
CONFIG_ASSERT=n
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_LOG_BACKEND_MOCK=y
|
CONFIG_LOG_BACKEND_MOCK=y
|
||||||
|
CONFIG_LOG_OUTPUT=y
|
||||||
CONFIG_LOG_BACKEND_UART=n
|
CONFIG_LOG_BACKEND_UART=n
|
||||||
CONFIG_SOC_LOG_LEVEL_OFF=y
|
CONFIG_SOC_LOG_LEVEL_OFF=y
|
||||||
CONFIG_ARCH_LOG_LEVEL_OFF=y
|
CONFIG_ARCH_LOG_LEVEL_OFF=y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue