Skip to content

Commit c0808e3

Browse files
nordic-krchnashif
authored andcommitted
logging: Minimal mode configuration cleanup
Remove LOG_MINIMAL kconfig option which was confusing since LOG_MODE_MINIMAL existed. LOG_MINIMAL was used to force minimal mode but because of invalid dependencies it was leading to issues. Refactored code to use LOG_MODE_MINIMAL everywhere and renamed LOG_MINIMAL to LOG_DEFAULT_MINIMAL which has impact on defualt logging mode (which still can be later changed in conf file or in menuconfig). Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 66130da commit c0808e3

File tree

13 files changed

+23
-24
lines changed

13 files changed

+23
-24
lines changed

include/logging/log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static inline void log_printk(const char *fmt, va_list ap)
289289
char *z_log_strdup(const char *str);
290290
static inline char *log_strdup(const char *str)
291291
{
292-
if (IS_ENABLED(CONFIG_LOG_MINIMAL) || IS_ENABLED(CONFIG_LOG2)) {
292+
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL) || IS_ENABLED(CONFIG_LOG2)) {
293293
return (char *)str;
294294
}
295295

include/logging/log_core.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern "C" {
3333
#define CONFIG_LOG_MAX_LEVEL 0U
3434
#endif
3535

36-
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MINIMAL)
36+
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MODE_MINIMAL)
3737
#define CONFIG_LOG_DOMAIN_ID 0U
3838
#endif
3939

@@ -299,7 +299,7 @@ static inline char z_log_minimal_level_to_char(int level)
299299
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
300300
break; \
301301
} \
302-
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
302+
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
303303
Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \
304304
break; \
305305
} \
@@ -353,7 +353,7 @@ static inline char z_log_minimal_level_to_char(int level)
353353
uint32_t filters = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \
354354
(_dsource)->filters : 0;\
355355
\
356-
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
356+
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
357357
Z_LOG_TO_PRINTK(_level, "%s", _str); \
358358
z_log_minimal_hexdump_print(_level, \
359359
(const char *)_data, _len);\
@@ -471,7 +471,7 @@ enum log_strdup_action {
471471
};
472472

473473
#define Z_LOG_PRINTK(...) do { \
474-
if (IS_ENABLED(CONFIG_LOG_MINIMAL) || !IS_ENABLED(CONFIG_LOG2)) { \
474+
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL) || !IS_ENABLED(CONFIG_LOG2)) { \
475475
z_log_minimal_printk(__VA_ARGS__); \
476476
break; \
477477
} \
@@ -731,7 +731,7 @@ __syscall void z_log_hexdump_from_user(uint32_t src_level_val,
731731
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
732732
break; \
733733
} \
734-
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
734+
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
735735
Z_LOG_TO_VPRINTK(_level, _str, _valist); \
736736
break; \
737737
} \
@@ -778,7 +778,7 @@ static inline log_arg_t z_log_do_strdup(uint32_t msk, uint32_t idx,
778778
log_arg_t param,
779779
enum log_strdup_action action)
780780
{
781-
#ifndef CONFIG_LOG_MINIMAL
781+
#ifndef CONFIG_LOG_MODE_MINIMAL
782782
char *z_log_strdup(const char *str);
783783

784784
if (msk & (1 << idx)) {

include/logging/log_ctrl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ uint32_t log_get_strdup_pool_utilization(void);
189189
*/
190190
uint32_t log_get_strdup_longest_string(void);
191191

192-
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG_MINIMAL)
192+
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL)
193193
#define LOG_CORE_INIT() log_core_init()
194194
#define LOG_INIT() log_init()
195195
#define LOG_PANIC() log_panic()

kernel/include/kernel_arch_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ uintptr_t arch_page_info_get(void *addr, uintptr_t *location,
540540
* Early boot console output hook
541541
*
542542
* Definition of this function is optional. If implemented, any invocation
543-
* of printk() (or logging calls with CONFIG_LOG_MINIMAL which are backed by
543+
* of printk() (or logging calls with CONFIG_LOG_MODE_MINIMAL which are backed by
544544
* printk) will default to sending characters to this function. It is
545545
* useful for early boot debugging before main serial or console drivers
546546
* come up.

subsys/bluetooth/host/monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ extern void __printk_hook_install(int (*fn)(int));
233233
extern void __stdout_hook_install(int (*fn)(int));
234234
#endif /* !CONFIG_UART_CONSOLE */
235235

236-
#ifndef CONFIG_LOG_MINIMAL
236+
#ifndef CONFIG_LOG_MODE_MINIMAL
237237
struct monitor_log_ctx {
238238
size_t total_len;
239239
char msg[MONITOR_MSG_MAX];
@@ -375,7 +375,7 @@ static const struct log_backend_api monitor_log_api = {
375375
};
376376

377377
LOG_BACKEND_DEFINE(bt_monitor, monitor_log_api, true);
378-
#endif /* CONFIG_LOG_MINIMAL */
378+
#endif /* CONFIG_LOG_MODE_MINIMAL */
379379

380380
static int bt_monitor_init(const struct device *d)
381381
{

subsys/logging/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
if(NOT CONFIG_LOG_MINIMAL)
3+
if(NOT CONFIG_LOG_MODE_MINIMAL)
44
zephyr_sources_ifdef(
55
CONFIG_LOG
66
log_list.c

subsys/logging/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ rsource "Kconfig.mode"
1414

1515
rsource "Kconfig.filtering"
1616

17-
if !LOG_FRONTEND && !LOG_MINIMAL
17+
if !LOG_FRONTEND && !LOG_MODE_MINIMAL
1818

1919
rsource "Kconfig.formatting"
2020

2121
rsource "Kconfig.processing"
2222

2323
rsource "Kconfig.backends"
2424

25-
endif # !LOG_FRONTEND && !LOG_MINIMAL
25+
endif # !LOG_FRONTEND && !LOG_MODE_MINIMAL
2626

2727
rsource "Kconfig.misc"
2828

subsys/logging/Kconfig.filtering

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ menu "Logging levels filtering"
55

66
config LOG_RUNTIME_FILTERING
77
bool "Runtime filtering reconfiguration"
8-
depends on !LOG_FRONTEND && !LOG_MINIMAL
8+
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
99
help
1010
Allow runtime configuration of maximal, independent severity
1111
level for instance.

subsys/logging/Kconfig.misc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ menu "Misc"
55

66
config LOG_DOMAIN_ID
77
int "Domain ID"
8-
depends on !LOG_MINIMAL
8+
depends on !LOG_MODE_MINIMAL
99
default 0
1010
range 0 7
1111
help
@@ -14,7 +14,7 @@ config LOG_DOMAIN_ID
1414
config LOG_CMDS
1515
bool "Enable shell commands"
1616
depends on SHELL
17-
depends on !LOG_FRONTEND && !LOG_MINIMAL
17+
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
1818
default y if SHELL
1919

2020
config LOG_TEST_CLEAR_MESSAGE_SPACE

subsys/logging/Kconfig.mode

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
choice LOG_MODE
55
prompt "Mode"
6+
default LOG_MODE_MINIMAL if LOG_DEFAULT_MINIMAL
67
default LOG_MODE_DEFERRED
78

89
config LOG_MODE_DEFERRED
@@ -71,7 +72,5 @@ config LOG_IMMEDIATE
7172
default y if LOG_MODE_IMMEDIATE
7273
default y if LOG2_MODE_IMMEDIATE
7374

74-
config LOG_MINIMAL
75+
config LOG_DEFAULT_MINIMAL
7576
bool
76-
imply PRINTK
77-
default y if LOG_MODE_MINIMAL

0 commit comments

Comments
 (0)