Skip to content

Commit ec38bcb

Browse files
nordic-krchgmarull
authored andcommitted
[nrf fromtree] shell: Allow custom shell log backend implementation
Shell is capable of acting as the logging backend and multiplex logging messages with shell content. It expects that logging messages goes through the logging backend. However, there is an option that logs go only to the custom logging frontend. In that case this default approach does not work and logging frontend cannot be easily integrated with the shell (due to its custom nature). Add Kconfig option SHELL_LOG_BACKEND_OOB which prevent compilation of the default shell log backend. When enabled, application can provide frontend specific implementation to integrate shell with the logging. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 05dd68a)
1 parent a6662ff commit ec38bcb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

subsys/shell/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ zephyr_sources_ifdef(
1111
shell_ops.c
1212
)
1313

14-
zephyr_sources_ifdef(
15-
CONFIG_SHELL_LOG_BACKEND
16-
shell_log_backend.c
14+
if(NOT CONFIG_SHELL_LOG_BACKEND_CUSTOM)
15+
zephyr_sources_ifdef(
16+
CONFIG_SHELL_LOG_BACKEND
17+
shell_log_backend.c
1718
)
19+
endif()
1820

1921
zephyr_sources_ifdef(
2022
CONFIG_SHELL_HELP

subsys/shell/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ config SHELL_LOG_BACKEND
277277
using the shell backend's LOG_LEVEL option
278278
(e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
279279

280+
config SHELL_LOG_BACKEND_CUSTOM
281+
bool "Use custom backend implementation"
282+
help
283+
When enabled, standard implementation of shell log backend is not included.
284+
It allows to provide custom implementation of multiplexing logging messages
285+
with shell data.
286+
280287
config SHELL_LOG_FORMAT_TIMESTAMP
281288
bool "Format timestamp"
282289
default y

0 commit comments

Comments
 (0)