From patchwork Sun May 31 14:36:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 246890 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Sun, 31 May 2020 14:36:44 +0000 Subject: [PATCH 1/1] log: don't show function by default Message-ID: <20200531143644.7592-1-xypron.glpk@gmx.de> The name of the function emitting a log message may be of interest for a developer but is distracting for normal users. See the example below: try_load_entry() Booting: Debian Make the default format for log messages customizable. By default show only the message text. Signed-off-by: Heinrich Schuchardt --- common/Kconfig | 18 ++++++++++++++++++ include/log.h | 12 +++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/common/Kconfig b/common/Kconfig index 7872bc46cd..60cae77f20 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -792,6 +792,24 @@ config TPL_LOG_CONSOLE endif +config LOGF_FILE + bool "Show source file name in log messages by default" + help + Show the source file name in log messages by default. This value + can be overridden using the 'log format' command. + +config LOGF_LINE + bool "Show source line number in log messages by default" + help + Show the source line number in log messages by default. This value + can be overridden using the 'log format' command. + +config LOGF_FUNC + bool "Show function name in log messages by default" + help + Show the function name in log messages by default. This value can + be overridden using the 'log format' command. + config LOG_ERROR_RETURN bool "Log all functions which return an error" help diff --git a/include/log.h b/include/log.h index df65398c04..b45a4565a3 100644 --- a/include/log.h +++ b/include/log.h @@ -411,7 +411,17 @@ enum log_fmt { LOGF_MSG, LOGF_COUNT, - LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG), + LOGF_DEFAULT = +#ifdef CONFIG_LOGF_FILE + (1 << LOGF_FILE) | +#endif +#ifdef CONFIG_LOGF_LINE + (1 << LOGF_LINE) | +#endif +#ifdef CONFIG_LOGF_FUNC + (1 << LOGF_FUNC) | +#endif + (1 << LOGF_MSG); LOGF_ALL = 0x3f, };