1# Copyright (c) 2021 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menu "Output Formatting"
5
6menu "Prepend non-hexdump log message with function name"
7	depends on !LOG_FRONTEND_ONLY
8
9config LOG_FUNC_NAME_PREFIX_ERR
10	bool "Error messages prepended"
11
12config LOG_FUNC_NAME_PREFIX_WRN
13	bool "Warning messages prepended"
14
15config LOG_FUNC_NAME_PREFIX_INF
16	bool "Info messages prepended"
17
18config LOG_FUNC_NAME_PREFIX_DBG
19	bool "Debug messages prepended"
20	default y
21
22endmenu
23
24menuconfig LOG_MIPI_SYST_ENABLE
25	bool "MIPI SyS-T format output"
26	select MIPI_SYST_LIB
27	select LOG_OUTPUT
28	help
29	  Enable MIPI SyS-T format output for the logger system.
30
31if LOG_MIPI_SYST_ENABLE
32
33config LOG_MIPI_SYST_USE_CATALOG
34	bool "Use MIPI Sys-T Catalog for logging"
35	depends on !PICOLIBC
36	select LOG_FMT_SECTION
37	select LOG_USE_TAGGED_ARGUMENTS
38	help
39	  Use MIPI Sys-T Catalog for logging instead of plain text.
40
41config LOG_MIPI_SYST_DISABLE_TIMESTAMP
42	bool "Disable MIPI Sys-T protocol timestamp"
43	help
44	  Remove the timestamp from the MIPI Sys-T protocol.
45
46config LOG_MIPI_SYST_CATALOG_ARGS_BUFFER_SIZE
47	int "Size of temporary arguments buffer when using Sys-T Catalog"
48	depends on LOG_MIPI_SYST_USE_CATALOG
49	default 1024
50	help
51	  The size (in bytes) of the temporary buffer to store the expanded
52	  argument list needed for the MIPI Sys-T library for processing
53	  catalog messages.
54
55config LOG_MIPI_SYST_ARGS_BUFFER_SIZE
56	int "Buffer size in bytes"
57	default 1024
58	help
59	  This user-configurable option specifies the maximum size (in bytes) to reserve in
60	  the call stack for processing the logging format strings MIPI Sys-T library.
61	  Increasing it will allow for longer strings to be logged at the expense of used
62	  stack space. Conversely decreasing it will lessen the stack burden at the expense
63	  of shorter maximum log strings.
64
65config LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID
66	bool "Output Log Message Source ID as Module ID"
67	default y if LOG_MIPI_SYST_USE_CATALOG
68	help
69	  Enable this option to output the log message source ID
70	  as the Sys-T message module ID (as in origin unit in Sys-T
71	  message header).
72
73config LOG_MIPI_SYST_MSG_DEFAULT_MODULE_ID
74	int "Default module ID in Sys-T message"
75	range 0 127
76	default 127 if LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID
77	default 0
78	help
79	  The default module ID embedded in the origin unit in
80	  Sys-T message header.
81
82	  If CONFIG_LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID is disabled,
83	  this will be used for all Sys-T messages.
84
85	  If CONFIG_LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID is enabled,
86	  this will be used for log messages without source IDs,
87	  for example, printk() if CONFIG_LOG_PRINTK is enabled.
88
89config LOG_MIPI_SYST_MSG_DEFAULT_UNIT_ID
90	int "Default unit ID in Sys-T message"
91	range 0 15
92	default 0
93	help
94	  The default unit ID embedded in the origin unit in
95	  Sys-T message header.
96
97endif # LOG_MIPI_SYST_ENABLE
98
99config LOG_DICTIONARY_SUPPORT
100	bool
101	select LOG_DICTIONARY_DB
102	help
103	  Enable support for dictionary based logging.
104
105	  Dictionary based logging is binary based where predefined strings
106	  are replaced with their equivalent addresses from the built binary
107	  image file in log output. This reduces the size required to store
108	  the log output when there are long format strings to be logged.
109
110	  This should be selected by the backend automatically.
111
112config LOG_THREAD_ID_PREFIX
113	bool "Thread ID prefix"
114	help
115	  Enable support for prefixing log message with thread name or ID.
116	  Thread name is used if THREAD_NAME is enabled.
117
118config LOG_CUSTOM_FORMAT_SUPPORT
119	bool "Custom format support"
120	default n
121	help
122	  Enable support for custom formatter.
123	  Allows custom format callbacks registering for logging backend.
124
125config LOG_IMMEDIATE_CLEAN_OUTPUT
126	bool "Clean log output"
127	depends on LOG_MODE_IMMEDIATE
128	help
129	  If enabled, interrupts are locked during whole log message processing.
130	  As a result, processing on one log message cannot be interrupted by
131	  another one and output is clean, not interleaved. However, enabling
132	  this option is causing interrupts locking for significant amount of
133	  time (up to multiple milliseconds).
134
135config LOG_BACKEND_SHOW_TIMESTAMP
136	bool "Timestamps in the backend"
137	default y
138	help
139	  When enabled, selected backend prints timestamps with log.
140
141config LOG_BACKEND_SHOW_LEVEL
142	bool "Levels in the backend"
143	default y
144	help
145	  When enabled, selected backend prints levels with log.
146
147config LOG_BACKEND_SHOW_COLOR
148	bool "Colors in the backend"
149	default y if LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \
150	           || LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM || SHELL_LOG_BACKEND
151	help
152	  When enabled selected backend prints errors in red and warning in yellow.
153
154if LOG_BACKEND_SHOW_COLOR
155
156config LOG_INFO_COLOR_GREEN
157	bool "Use green color for info level logs"
158
159config LOG_DBG_COLOR_BLUE
160	bool "Use blue color for debug level logs"
161
162endif # LOG_BACKEND_SHOW_COLOR
163
164config LOG_TAG_MAX_LEN
165	int "Tag max length"
166	default 0
167	range 0 64
168	help
169	  Setting non-zero value enables option to specify a tag which is
170	  prepended to each log message. Tag can be changed at runtime.
171
172config LOG_TAG_DEFAULT
173	string "Default tag"
174	depends on LOG_TAG_MAX_LEN > 0
175	default ""
176	help
177	  Initial tag.
178
179config LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP
180	bool
181	help
182	  Selected by log backends that supports timestamp formatting.
183
184config LOG_BACKEND_FORMAT_TIMESTAMP
185	bool "Timestamp formatting in the backend"
186	depends on LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP
187	default y if LOG_BACKEND_SHOW_TIMESTAMP
188	help
189	  When enabled timestamp is formatted.
190
191choice LOG_BACKEND_FORMAT_TIMESTAMP_MODE
192	prompt "Timestamp format mode"
193	default LOG_OUTPUT_FORMAT_DATE_TIMESTAMP if LOG_TIMESTAMP_USE_REALTIME && POSIX_C_LANG_SUPPORT_R
194	default LOG_OUTPUT_FORMAT_TIME_TIMESTAMP
195
196config LOG_OUTPUT_FORMAT_TIME_TIMESTAMP
197	bool "Format timestamp in time format"
198	help
199	  When enabled timestamp is formatted to hh:mm:ss.ms,us.
200
201config LOG_OUTPUT_FORMAT_DATE_TIMESTAMP
202	bool "Format timestamp in date format"
203	depends on POSIX_C_LANG_SUPPORT_R
204	help
205	  When enabled timestamp is formatted to YYYY-MM-DD hh:mm:ss.ms,us.
206
207config LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP
208	bool "Format timestamp in ISO 8601 format"
209	depends on POSIX_C_LANG_SUPPORT_R
210	help
211	  When enabled timestamp is formatted to YYYY-MM-DDThh:mm:ss,ffffffZ.
212
213config LOG_OUTPUT_FORMAT_LINUX_TIMESTAMP
214	bool "Format timestamp in Linux format"
215	help
216	  This formatting is something in the middle between the pure raw format
217	  and the hh:mm:ss:ms,us one. It resembles the Linux's kernel format in
218	  which timestamps are printed as fixed point values with seconds on the
219	  left side of the point and microseconds on the right side.
220
221config LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP
222	bool "Custom timestamp format support"
223	help
224	  Enable support for custom formatter for the timestamp.
225	  It will be applied to all backends except the syslog net backend.
226
227endchoice
228
229config LOG_BACKEND_CRLF_NONE
230	bool "Prevent adding CR and LF in logger"
231	help
232	  When enabled, selected backend prints do not add CR and LF to log
233
234config LOG_BACKEND_CRLF_LFONLY
235	bool "Force a single LF for line breaks in logger"
236	help
237	  When enabled, selected backend prints use single LF for line breaks in log
238
239config LOG_BACKEND_SKIP_SOURCE
240	bool "Skip logging the source"
241	help
242	  When enabled, selected backend prints do not add the source to log
243
244endmenu
245