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:
Krzysztof Chruscinski 2021-11-19 07:59:23 +01:00 committed by Anas Nashif
commit c0808e3f59
13 changed files with 23 additions and 24 deletions

View file

@ -289,7 +289,7 @@ static inline void log_printk(const char *fmt, va_list ap)
char *z_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;
}

View file

@ -33,7 +33,7 @@ extern "C" {
#define CONFIG_LOG_MAX_LEVEL 0U
#endif
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MINIMAL)
#if !defined(CONFIG_LOG) || defined(CONFIG_LOG_MODE_MINIMAL)
#define CONFIG_LOG_DOMAIN_ID 0U
#endif
@ -299,7 +299,7 @@ static inline char z_log_minimal_level_to_char(int level)
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
break; \
} \
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \
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) ? \
(_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_minimal_hexdump_print(_level, \
(const char *)_data, _len);\
@ -471,7 +471,7 @@ enum log_strdup_action {
};
#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__); \
break; \
} \
@ -731,7 +731,7 @@ __syscall void z_log_hexdump_from_user(uint32_t src_level_val,
if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \
break; \
} \
if (IS_ENABLED(CONFIG_LOG_MINIMAL)) { \
if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \
Z_LOG_TO_VPRINTK(_level, _str, _valist); \
break; \
} \
@ -778,7 +778,7 @@ static inline log_arg_t z_log_do_strdup(uint32_t msk, uint32_t idx,
log_arg_t param,
enum log_strdup_action action)
{
#ifndef CONFIG_LOG_MINIMAL
#ifndef CONFIG_LOG_MODE_MINIMAL
char *z_log_strdup(const char *str);
if (msk & (1 << idx)) {

View file

@ -189,7 +189,7 @@ uint32_t log_get_strdup_pool_utilization(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_INIT() log_init()
#define LOG_PANIC() log_panic()

View file

@ -540,7 +540,7 @@ uintptr_t arch_page_info_get(void *addr, uintptr_t *location,
* Early boot console output hook
*
* 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
* useful for early boot debugging before main serial or console drivers
* come up.

View file

@ -233,7 +233,7 @@ extern void __printk_hook_install(int (*fn)(int));
extern void __stdout_hook_install(int (*fn)(int));
#endif /* !CONFIG_UART_CONSOLE */
#ifndef CONFIG_LOG_MINIMAL
#ifndef CONFIG_LOG_MODE_MINIMAL
struct monitor_log_ctx {
size_t total_len;
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);
#endif /* CONFIG_LOG_MINIMAL */
#endif /* CONFIG_LOG_MODE_MINIMAL */
static int bt_monitor_init(const struct device *d)
{

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
if(NOT CONFIG_LOG_MINIMAL)
if(NOT CONFIG_LOG_MODE_MINIMAL)
zephyr_sources_ifdef(
CONFIG_LOG
log_list.c

View file

@ -14,7 +14,7 @@ rsource "Kconfig.mode"
rsource "Kconfig.filtering"
if !LOG_FRONTEND && !LOG_MINIMAL
if !LOG_FRONTEND && !LOG_MODE_MINIMAL
rsource "Kconfig.formatting"
@ -22,7 +22,7 @@ rsource "Kconfig.processing"
rsource "Kconfig.backends"
endif # !LOG_FRONTEND && !LOG_MINIMAL
endif # !LOG_FRONTEND && !LOG_MODE_MINIMAL
rsource "Kconfig.misc"

View file

@ -5,7 +5,7 @@ menu "Logging levels filtering"
config LOG_RUNTIME_FILTERING
bool "Runtime filtering reconfiguration"
depends on !LOG_FRONTEND && !LOG_MINIMAL
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
help
Allow runtime configuration of maximal, independent severity
level for instance.

View file

@ -5,7 +5,7 @@ menu "Misc"
config LOG_DOMAIN_ID
int "Domain ID"
depends on !LOG_MINIMAL
depends on !LOG_MODE_MINIMAL
default 0
range 0 7
help
@ -14,7 +14,7 @@ config LOG_DOMAIN_ID
config LOG_CMDS
bool "Enable shell commands"
depends on SHELL
depends on !LOG_FRONTEND && !LOG_MINIMAL
depends on !LOG_FRONTEND && !LOG_MODE_MINIMAL
default y if SHELL
config LOG_TEST_CLEAR_MESSAGE_SPACE

View file

@ -3,6 +3,7 @@
choice LOG_MODE
prompt "Mode"
default LOG_MODE_MINIMAL if LOG_DEFAULT_MINIMAL
default LOG_MODE_DEFERRED
config LOG_MODE_DEFERRED
@ -71,7 +72,5 @@ config LOG_IMMEDIATE
default y if LOG_MODE_IMMEDIATE
default y if LOG2_MODE_IMMEDIATE
config LOG_MINIMAL
config LOG_DEFAULT_MINIMAL
bool
imply PRINTK
default y if LOG_MODE_MINIMAL

View file

@ -3,7 +3,7 @@
menu "Processing"
if !LOG_MINIMAL
if !LOG_MODE_MINIMAL
config LOG_PRINTK
bool "Process printk messages"
@ -167,6 +167,6 @@ config LOG_SPEED
If enabled, logging may take more code size to get faster logging.
endif # LOG2
endif # !LOG_MINIMAL
endif # !LOG_MODE_MINIMAL
endmenu

View file

@ -224,7 +224,7 @@ config SHELL_CMD_ROOT
config SHELL_LOG_BACKEND
bool "Enable shell log backend"
depends on LOG && !LOG_MINIMAL
depends on LOG && !LOG_MODE_MINIMAL
default y if LOG
help
When enabled, backend will use the shell for logging.

View file

@ -79,7 +79,7 @@ config TEST_LOGGING_DEFAULTS
bool "Enable test case logging defaults"
depends on TEST
select LOG
imply LOG_MINIMAL
select LOG_DEFAULT_MINIMAL
default y
help
Option which implements default policy of enabling logging in