U-Boot logging

Massimo Pegorer massimo.pegorer+oss at gmail.com
Tue Aug 15 21:00:49 CEST 2023


I had a trip into U-Boot logging and I am quite confused. I read the
documentation at doc/develop/logging.rst and had a look at source code
in log.h log.c printk.h Kconfig and other files, but the picture is
still quite foggy and, let's say, 'complicated'.

The documentation does not mention at all CONFIG_LOGLEVEL, but pr_xxx
macros rely on its value (and then on log_xxx macros). While log_xxx
definitions, instead, depends on CONFIG_LOG and other CONFIG_LOG_XXX

It is not clear when/if pr_xxx and/or log/log_xxx should be used. Is
any preferred and why? Is there a specific reason to keep both?

Neither the constrains and relations between Kconfig variables are
clear. CONFIG_LOGLEVEL and CONFIG_LOG are in different section
of menuconfig: Console and Logging. The semantic is also a little
bit different: for LOGLEVEL, values smaller than the console loglevel
will be compiled in; for LOG_MAX_LEVEL, instead, any value higher
than this will be ignored.

The doc states that 'If CONFIG_LOG is not set, then no logging will
be available'. But a few lines below 'If logging is disabled, the
default behaviour is to output any message at level LOGL_INFO and
below'. This sounds inconsistent to me.

I see a lot of To Do tasks listed in logging.rst, like converting
some other logging statements like debug() and error(). I wonder if
something can be improved, and in case how: I could commit some of
my spare time.

Thanks. Regards.


More information about the U-Boot mailing list