From 72ec6ce4db682c89bdcdd5688294ca075b8832a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 28 Sep 2023 09:29:26 +0200 Subject: [PATCH] logging: Fix _LOG_LEVEL_RESOLVE macro for LOG_LEVEL case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Z_LOG_EVAL returns 1 for non-zero log level so if LOG_LEVEL was 0 with intention to disable logs in the current module Z_LOG_EVAL was jumping to the second option and was applying default logging level. Since LOG_LEVEL set to 0 should also lead to evaluation of LOG_LEVEL COND_CODE_0 is added. Signed-off-by: Krzysztof Chruściński --- include/zephyr/logging/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/logging/log.h b/include/zephyr/logging/log.h index 7b7dbb56b8a..e6db645c742 100644 --- a/include/zephyr/logging/log.h +++ b/include/zephyr/logging/log.h @@ -290,7 +290,7 @@ void z_log_vprintk(const char *fmt, va_list ap); #define _LOG_LEVEL_RESOLVE(...) LOG_LEVEL_NONE #else #define _LOG_LEVEL_RESOLVE(...) \ - Z_LOG_EVAL(LOG_LEVEL, \ + Z_LOG_EVAL(COND_CODE_0(LOG_LEVEL, (1), (LOG_LEVEL)), \ (GET_ARG_N(2, __VA_ARGS__, LOG_LEVEL)), \ (GET_ARG_N(2, __VA_ARGS__, CONFIG_LOG_DEFAULT_LEVEL))) #endif