From: Heinrich Schuchardt Date: Sun, 9 Feb 2020 13:08:11 +0100 Subject: [U-Boot] logging Message-ID: <7df8bed1-8e2e-94ae-2d11-acedacacef34@gmx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Hello Simon, I would like to convert printf and debug messages in the UEFI sub-system to log messages. Currently if CONFIG_LOG=n, log_*() functions are mapped to log_nop(). So no output is provided independent of the criticality of the message. What I would like to do is map log_err() to printf() and log_debug() to debug() if CONFIG_LOG=n . This way we could get the same console output no matter if CONFIG_LOG is enabled. Would this make sense to you? #if CONFIG_IS_ENABLED(LOG) #define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL) #define log_err(_fmt...)        log(LOG_CATEGORY, LOGL_ERR, ##_fmt) #define log_warning(_fmt...)    log(LOG_CATEGORY, LOGL_WARNING, ##_fmt) #define log_notice(_fmt...)     log(LOG_CATEGORY, LOGL_NOTICE, ##_fmt) #define log_info(_fmt...)       log(LOG_CATEGORY, LOGL_INFO, ##_fmt) #define log_debug(_fmt...)      log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt) #define log_content(_fmt...)    log(LOG_CATEGORY, LOGL_DEBUG_CONTENT, ##_fmt) #define log_io(_fmt...)         log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt) #else #define _LOG_MAX_LEVEL LOGL_INFO #define log_err(_fmt...)        printf(##_fmt) #define log_warning(_fmt...)    printf(##_fmt) #define log_notice(_fmt...)     printf(##_fmt) #define log_info(_fmt...)       printf(##_fmt) #define log_debug(_fmt...)      debug(##_fmt) #define log_content(_fmt...)    log_nop(LOG_CATEGORY, \                                         LOGL_DEBUG_CONTENT, ##_fmt) #define log_io(_fmt...)         log_nop(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt) #endif Best regards Heinrich