log: don't show function by default

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 <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt 2020-06-17 21:52:44 +02:00 committed by Simon Glass
parent 8af45b1f20
commit 3c21d7738a
6 changed files with 54 additions and 10 deletions

View file

@ -12,6 +12,7 @@
#include <stdio.h>
#include <linker_lists.h>
#include <dm/uclass-id.h>
#include <linux/bitops.h>
#include <linux/list.h>
struct cmd_tbl;
@ -411,7 +412,6 @@ enum log_fmt {
LOGF_MSG,
LOGF_COUNT,
LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG),
LOGF_ALL = 0x3f,
};
@ -460,4 +460,20 @@ static inline int log_init(void)
}
#endif
/**
* log_get_default_format() - get default log format
*
* The default log format is configurable via
* CONFIG_LOGF_FILE, CONFIG_LOGF_LINE, CONFIG_LOGF_FUNC.
*
* Return: default log format
*/
static inline int log_get_default_format(void)
{
return BIT(LOGF_MSG) |
(IS_ENABLED(CONFIG_LOGF_FILE) ? BIT(LOGF_FILE) : 0) |
(IS_ENABLED(CONFIG_LOGF_LINE) ? BIT(LOGF_LINE) : 0) |
(IS_ENABLED(CONFIG_LOGF_FUNC) ? BIT(LOGF_FUNC) : 0);
}
#endif