[U-Boot] logging
Heinrich Schuchardt
xypron.glpk at gmx.de
Sun Feb 9 13:08:11 CET 2020
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
More information about the U-Boot
mailing list