log: Support outputing function names in SPL
The output is garbled when tiny printf() is used. Correct this by adding
a special case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/common/log_console.c b/common/log_console.c
index f1dcc04..bb091ce 100644
--- a/common/log_console.c
+++ b/common/log_console.c
@@ -37,8 +37,14 @@
printf("%s:", rec->file);
if (fmt & BIT(LOGF_LINE))
printf("%d-", rec->line);
- if (fmt & BIT(LOGF_FUNC))
- printf("%*s()", CONFIG_LOGF_FUNC_PAD, rec->func);
+ if (fmt & BIT(LOGF_FUNC)) {
+ if (CONFIG_IS_ENABLED(USE_TINY_PRINTF)) {
+ printf("%s()", rec->func);
+ } else {
+ printf("%*s()", CONFIG_LOGF_FUNC_PAD,
+ rec->func);
+ }
+ }
}
if (fmt & BIT(LOGF_MSG))
printf("%s%s", add_space ? " " : "", rec->msg);