1# Copyright (c) 2021 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4config LOG_BACKEND_UART
5	bool "UART backend"
6	depends on UART_CONSOLE
7	default y if !SHELL_BACKEND_SERIAL && !SHELL_BACKEND_RTT
8	select LOG_OUTPUT
9	select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP
10	help
11	  When enabled backend is using UART to output logs.
12
13if LOG_BACKEND_UART
14
15config LOG_BACKEND_UART_ASYNC
16	bool "Use UART Asynchronous API"
17	depends on UART_ASYNC_API
18	depends on !LOG_BACKEND_UART_OUTPUT_DICTIONARY_HEX
19
20config LOG_BACKEND_UART_BUFFER_SIZE
21	int "Maximum number of bytes to buffer in RAM before flushing"
22	default 32 if LOG_BACKEND_UART_ASYNC
23	default 1
24	help
25	  In deferred logging mode, sets the maximum number of bytes which can be buffered in
26	  RAM before log_output_flush is automatically called on the UART backend.  The buffer
27	  will also be flushed after each log message.
28
29	  In immediate logging mode, processed log messages are not buffered and are always
30	  output one byte at a time.
31
32config LOG_BACKEND_UART_AUTOSTART
33	bool "Automatically start UART backend"
34	default y
35	help
36	  When enabled automatically start the UART logging backend on
37	  application start. When disabled, the application needs to start
38	  the backend manually using log_backend_enable().
39
40backend = UART
41backend-str = uart
42source "subsys/logging/Kconfig.template.log_format_config"
43
44if LOG_BACKEND_UART_OUTPUT_DICTIONARY
45
46choice
47	prompt "Dictionary mode output format"
48	default LOG_BACKEND_UART_OUTPUT_DICTIONARY_BIN
49
50config LOG_BACKEND_UART_OUTPUT_DICTIONARY_BIN
51	bool "Dictionary (binary)"
52	help
53	  Dictionary-based logging output in binary.
54
55config LOG_BACKEND_UART_OUTPUT_DICTIONARY_HEX
56	bool "Dictionary (hexadecimal)"
57	help
58	  Dictionary-based logging output in hexadecimal. Supported only for UART backend.
59
60endchoice
61
62endif # LOG_BACKEND_UART_OUTPUT_DICTIONARY
63
64endif # LOG_BACKEND_UART
65