Commit c0808e3f authored by Krzysztof Chruściński's avatar Krzysztof Chruściński Committed by Anas Nashif
Browse files

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: default avatarKrzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
parent 66130da4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}

+6 −6
Original line number Diff line number Diff line
@@ -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)) {
+1 −1
Original line number Diff line number Diff line
@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -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.
+2 −2
Original line number Diff line number Diff line
@@ -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)
{
Loading