summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-21 06:10:53 +0300
committerTom Rini <trini@konsulko.com>2021-03-13 01:41:35 +0300
commit9ad7a6c25c7142a46fe4b811c13bc3280c4bb27f (patch)
tree3ad69164919285a4f79ecd37355df16db6945f6a /include
parent79d5983b61e41d5c586489b03e75a75961d31041 (diff)
downloadu-boot-9ad7a6c25c7142a46fe4b811c13bc3280c4bb27f.tar.xz
log: Handle line continuation
When multiple log() calls are used which don't end in newline, the log prefix is prepended multiple times in the same line. This makes the output look strange. Fix this by detecting when the previous log record did not end in newline. In that case, setting a flag. Drop the unused BUFFSIZE in the test while we are here. As an example implementation, update log_console to check the flag and produce the expected output. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/global_data.h6
-rw-r--r--include/log.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index b6a9991fc9..c24f5e0e97 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -410,6 +410,12 @@ struct global_data {
* This value is used as logging level for continuation messages.
*/
int logl_prev;
+ /**
+ * @log_cont: Previous log line did not finished wtih \n
+ *
+ * This allows for chained log messages on the same line
+ */
+ bool log_cont;
#endif
#if CONFIG_IS_ENABLED(BLOBLIST)
/**
diff --git a/include/log.h b/include/log.h
index da053b0a6e..c0453d2f97 100644
--- a/include/log.h
+++ b/include/log.h
@@ -326,6 +326,8 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
enum log_rec_flags {
/** @LOGRECF_FORCE_DEBUG: Force output of debug record */
LOGRECF_FORCE_DEBUG = BIT(0),
+ /** @LOGRECF_CONT: Continuation of previous log record */
+ LOGRECF_CONT = BIT(1),
};
/**