Commit Graph

8 Commits

Author SHA1 Message Date
Simon Glass
7bd06587de log: Add return-checking macros for 0 being success
The existing log_ret() and log_msg_ret() macros consider an error to be
less than zero. But some function may return a positive number to indicate
a different kind of failure. Add macros to check for that also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-12 17:41:35 -05:00
Simon Glass
9ad7a6c25c 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>
2021-03-12 17:41:35 -05:00
Heinrich Schuchardt
a6aaeb2a91 doc: fix doc/develop/logging.rst
Sphinx 3 builds fail due to doc/develop/logging.rst producing duplicate
labels.

Include logging.h only once in the API section and use cross-references for
the enums log_level_t and log_category_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-01-27 12:52:57 +01:00
Sean Anderson
8ba0f89abe doc: Update logging documentation
This updates logging documentation with some examples of the new commands
added in the previous commits. It also removes some items from the to-do
list which have been implemented.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30 11:00:13 -04:00
Sean Anderson
00ebb7feb7 doc: Add log kerneldocs to documentation
The functions in log.h are already mostly documented, so add them to the
generated documentation.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30 10:58:07 -04:00
Heinrich Schuchardt
d094a0734c log: allow for message continuation
Some drivers use macro pr_cont() for continuing a message sent via printk.
Hence if we want to convert printk messaging to using the logging system,
we must support continuation of log messages too.

As pr_cont() does not provide a message level we need a means of
remembering the last log level.

With the patch a pseudo log level LOGL_CONT as well as a pseudo log
category LOGC_CONT are introduced. Using these results in the application
of the same log level and category as in the previous log message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27 13:50:53 -04:00
Simon Glass
7ad1e0bcf3 log: Tidy up documentation
Fix up the documentation which was lost in a merge conflict in the
conversion to RST.

Fixes: 52d3df7fef ("log: Allow LOG_DEBUG to always enable log output")

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-22 11:26:14 -04:00
Heinrich Schuchardt
a7813918fe doc: move README.log to HTML documentation
Convert README.log to reStructuredText and add it to the generated HTML
documentation.

Assign doc/develop/logging.rst to the maintainer of LOGGING.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-06-11 20:52:11 -06:00