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 <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
66130da4c9
commit
c0808e3f59
13 changed files with 23 additions and 24 deletions
|
@ -289,7 +289,7 @@ static inline void log_printk(const char *fmt, va_list ap)
|
||||||
char *z_log_strdup(const char *str);
|
char *z_log_strdup(const char *str);
|
||||||
static inline char *log_strdup(const char *str)
|
static inline char *log_strdup(const char *str)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_LOG_MINIMAL) || IS_ENABLED(CONFIG_LOG2)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL) || IS_ENABLED(CONFIG_LOG2)) {
|
||||||
return (char *)str;
|
return (char *)str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ extern "C" {
|
||||||
#define CONFIG_LOG_MAX_LEVEL 0U
|
#define CONFIG_LOG_MAX_LEVEL 0U
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MINIMAL)
|
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MODE_MINIMAL)
|
||||||
#define CONFIG_LOG_DOMAIN_ID 0U
|
#define CONFIG_LOG_DOMAIN_ID 0U
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ static inline char z_log_minimal_level_to_char(int level)
|
||||||
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
|
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
|
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
|
||||||
Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \
|
Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
@ -353,7 +353,7 @@ static inline char z_log_minimal_level_to_char(int level)
|
||||||
uint32_t filters = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \
|
uint32_t filters = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \
|
||||||
(_dsource)->filters : 0;\
|
(_dsource)->filters : 0;\
|
||||||
\
|
\
|
||||||
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
|
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
|
||||||
Z_LOG_TO_PRINTK(_level, "%s", _str); \
|
Z_LOG_TO_PRINTK(_level, "%s", _str); \
|
||||||
z_log_minimal_hexdump_print(_level, \
|
z_log_minimal_hexdump_print(_level, \
|
||||||
(const char *)_data, _len);\
|
(const char *)_data, _len);\
|
||||||
|
@ -471,7 +471,7 @@ enum log_strdup_action {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Z_LOG_PRINTK(...) do { \
|
#define Z_LOG_PRINTK(...) do { \
|
||||||
if (IS_ENABLED(CONFIG_LOG_MINIMAL) || !IS_ENABLED(CONFIG_LOG2)) { \
|
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL) || !IS_ENABLED(CONFIG_LOG2)) { \
|
||||||
z_log_minimal_printk(__VA_ARGS__); \
|
z_log_minimal_printk(__VA_ARGS__); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
@ -731,7 +731,7 @@ __syscall void z_log_hexdump_from_user(uint32_t src_level_val,
|
||||||
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
|
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
|
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
|
||||||
Z_LOG_TO_VPRINTK(_level, _str, _valist); \
|
Z_LOG_TO_VPRINTK(_level, _str, _valist); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
@ -778,7 +778,7 @@ static inline log_arg_t z_log_do_strdup(uint32_t msk, uint32_t idx,
|
||||||
log_arg_t param,
|
log_arg_t param,
|
||||||
enum log_strdup_action action)
|
enum log_strdup_action action)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_LOG_MINIMAL
|
#ifndef CONFIG_LOG_MODE_MINIMAL
|
||||||
char *z_log_strdup(const char *str);
|
char *z_log_strdup(const char *str);
|
||||||
|
|
||||||
if (msk & (1 << idx)) {
|
if (msk & (1 << idx)) {
|
||||||
|
|
|
@ -189,7 +189,7 @@ uint32_t log_get_strdup_pool_utilization(void);
|
||||||
*/
|
*/
|
||||||
uint32_t log_get_strdup_longest_string(void);
|
uint32_t log_get_strdup_longest_string(void);
|
||||||
|
|
||||||
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG_MINIMAL)
|
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL)
|
||||||
#define LOG_CORE_INIT() log_core_init()
|
#define LOG_CORE_INIT() log_core_init()
|
||||||
#define LOG_INIT() log_init()
|
#define LOG_INIT() log_init()
|
||||||
#define LOG_PANIC() log_panic()
|
#define LOG_PANIC() log_panic()
|
||||||
|
|
|
@ -540,7 +540,7 @@ uintptr_t arch_page_info_get(void *addr, uintptr_t *location,
|
||||||
* Early boot console output hook
|
* Early boot console output hook
|
||||||
*
|
*
|
||||||
* Definition of this function is optional. If implemented, any invocation
|
* Definition of this function is optional. If implemented, any invocation
|
||||||
* of printk() (or logging calls with CONFIG_LOG_MINIMAL which are backed by
|
* of printk() (or logging calls with CONFIG_LOG_MODE_MINIMAL which are backed by
|
||||||
* printk) will default to sending characters to this function. It is
|
* printk) will default to sending characters to this function. It is
|
||||||
* useful for early boot debugging before main serial or console drivers
|
* useful for early boot debugging before main serial or console drivers
|
||||||
* come up.
|
* come up.
|
||||||
|
|
|
@ -233,7 +233,7 @@ extern void __printk_hook_install(int (*fn)(int));
|
||||||
extern void __stdout_hook_install(int (*fn)(int));
|
extern void __stdout_hook_install(int (*fn)(int));
|
||||||
#endif /* !CONFIG_UART_CONSOLE */
|
#endif /* !CONFIG_UART_CONSOLE */
|
||||||
|
|
||||||
#ifndef CONFIG_LOG_MINIMAL
|
#ifndef CONFIG_LOG_MODE_MINIMAL
|
||||||
struct monitor_log_ctx {
|
struct monitor_log_ctx {
|
||||||
size_t total_len;
|
size_t total_len;
|
||||||
char msg[MONITOR_MSG_MAX];
|
char msg[MONITOR_MSG_MAX];
|
||||||
|
@ -375,7 +375,7 @@ static const struct log_backend_api monitor_log_api = {
|
||||||
};
|
};
|
||||||
|
|
||||||
LOG_BACKEND_DEFINE(bt_monitor, monitor_log_api, true);
|
LOG_BACKEND_DEFINE(bt_monitor, monitor_log_api, true);
|
||||||
#endif /* CONFIG_LOG_MINIMAL */
|
#endif /* CONFIG_LOG_MODE_MINIMAL */
|
||||||
|
|
||||||
static int bt_monitor_init(const struct device *d)
|
static int bt_monitor_init(const struct device *d)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
if(NOT CONFIG_LOG_MINIMAL)
|
if(NOT CONFIG_LOG_MODE_MINIMAL)
|
||||||
zephyr_sources_ifdef(
|
zephyr_sources_ifdef(
|
||||||
CONFIG_LOG
|
CONFIG_LOG
|
||||||
log_list.c
|
log_list.c
|
||||||
|
|
|
@ -14,7 +14,7 @@ rsource "Kconfig.mode"
|
||||||
|
|
||||||
rsource "Kconfig.filtering"
|
rsource "Kconfig.filtering"
|
||||||
|
|
||||||
if !LOG_FRONTEND && !LOG_MINIMAL
|
if !LOG_FRONTEND && !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
rsource "Kconfig.formatting"
|
rsource "Kconfig.formatting"
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ rsource "Kconfig.processing"
|
||||||
|
|
||||||
rsource "Kconfig.backends"
|
rsource "Kconfig.backends"
|
||||||
|
|
||||||
endif # !LOG_FRONTEND && !LOG_MINIMAL
|
endif # !LOG_FRONTEND && !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
rsource "Kconfig.misc"
|
rsource "Kconfig.misc"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ menu "Logging levels filtering"
|
||||||
|
|
||||||
config LOG_RUNTIME_FILTERING
|
config LOG_RUNTIME_FILTERING
|
||||||
bool "Runtime filtering reconfiguration"
|
bool "Runtime filtering reconfiguration"
|
||||||
depends on !LOG_FRONTEND && !LOG_MINIMAL
|
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
|
||||||
help
|
help
|
||||||
Allow runtime configuration of maximal, independent severity
|
Allow runtime configuration of maximal, independent severity
|
||||||
level for instance.
|
level for instance.
|
||||||
|
|
|
@ -5,7 +5,7 @@ menu "Misc"
|
||||||
|
|
||||||
config LOG_DOMAIN_ID
|
config LOG_DOMAIN_ID
|
||||||
int "Domain ID"
|
int "Domain ID"
|
||||||
depends on !LOG_MINIMAL
|
depends on !LOG_MODE_MINIMAL
|
||||||
default 0
|
default 0
|
||||||
range 0 7
|
range 0 7
|
||||||
help
|
help
|
||||||
|
@ -14,7 +14,7 @@ config LOG_DOMAIN_ID
|
||||||
config LOG_CMDS
|
config LOG_CMDS
|
||||||
bool "Enable shell commands"
|
bool "Enable shell commands"
|
||||||
depends on SHELL
|
depends on SHELL
|
||||||
depends on !LOG_FRONTEND && !LOG_MINIMAL
|
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
|
||||||
default y if SHELL
|
default y if SHELL
|
||||||
|
|
||||||
config LOG_TEST_CLEAR_MESSAGE_SPACE
|
config LOG_TEST_CLEAR_MESSAGE_SPACE
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
choice LOG_MODE
|
choice LOG_MODE
|
||||||
prompt "Mode"
|
prompt "Mode"
|
||||||
|
default LOG_MODE_MINIMAL if LOG_DEFAULT_MINIMAL
|
||||||
default LOG_MODE_DEFERRED
|
default LOG_MODE_DEFERRED
|
||||||
|
|
||||||
config LOG_MODE_DEFERRED
|
config LOG_MODE_DEFERRED
|
||||||
|
@ -71,7 +72,5 @@ config LOG_IMMEDIATE
|
||||||
default y if LOG_MODE_IMMEDIATE
|
default y if LOG_MODE_IMMEDIATE
|
||||||
default y if LOG2_MODE_IMMEDIATE
|
default y if LOG2_MODE_IMMEDIATE
|
||||||
|
|
||||||
config LOG_MINIMAL
|
config LOG_DEFAULT_MINIMAL
|
||||||
bool
|
bool
|
||||||
imply PRINTK
|
|
||||||
default y if LOG_MODE_MINIMAL
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
menu "Processing"
|
menu "Processing"
|
||||||
|
|
||||||
if !LOG_MINIMAL
|
if !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
config LOG_PRINTK
|
config LOG_PRINTK
|
||||||
bool "Process printk messages"
|
bool "Process printk messages"
|
||||||
|
@ -167,6 +167,6 @@ config LOG_SPEED
|
||||||
If enabled, logging may take more code size to get faster logging.
|
If enabled, logging may take more code size to get faster logging.
|
||||||
endif # LOG2
|
endif # LOG2
|
||||||
|
|
||||||
endif # !LOG_MINIMAL
|
endif # !LOG_MODE_MINIMAL
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -224,7 +224,7 @@ config SHELL_CMD_ROOT
|
||||||
|
|
||||||
config SHELL_LOG_BACKEND
|
config SHELL_LOG_BACKEND
|
||||||
bool "Enable shell log backend"
|
bool "Enable shell log backend"
|
||||||
depends on LOG && !LOG_MINIMAL
|
depends on LOG && !LOG_MODE_MINIMAL
|
||||||
default y if LOG
|
default y if LOG
|
||||||
help
|
help
|
||||||
When enabled, backend will use the shell for logging.
|
When enabled, backend will use the shell for logging.
|
||||||
|
|
|
@ -79,7 +79,7 @@ config TEST_LOGGING_DEFAULTS
|
||||||
bool "Enable test case logging defaults"
|
bool "Enable test case logging defaults"
|
||||||
depends on TEST
|
depends on TEST
|
||||||
select LOG
|
select LOG
|
||||||
imply LOG_MINIMAL
|
select LOG_DEFAULT_MINIMAL
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Option which implements default policy of enabling logging in
|
Option which implements default policy of enabling logging in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue