[U-Boot] [PATCH 03/33] log: Allow #define LOG_DEBUG to enable logging in a file

Simon Glass sjg at chromium.org
Sun Feb 17 03:25:15 UTC 2019


Hi BIn,

On Wed, 13 Feb 2019 at 10:36, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Tue, Jan 22, 2019 at 9:14 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > At present it is possible to '#define DEBUG' at the top of a file which
> > causes all debug() statements in that file to become active. There is
> > currently no equivalent with logging, but this is a useful function.
> >
> > Add a LOG_DEBUG define along with documentation.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  doc/README.log | 14 ++++++++++++++
> >  include/log.h  |  7 ++++++-
> >  2 files changed, 20 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/README.log b/doc/README.log
> > index 96bc9523ef..f8922af764 100644
> > --- a/doc/README.log
> > +++ b/doc/README.log
> > @@ -69,6 +69,20 @@ If CONFIG_LOG is not set, then no logging will be available.
> >  The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL.
> >
> >
> > +Temporary logging within a single file
> > +--------------------------------------
> > +
> > +Sometimes it is useful to turn on logging just in one file. You can use this:
> > +
> > +   #define LOG_DEBUG
> > +
> > +to enable building in of all logging statements in a single file. Put it at
> > +the top of the file, before any #includes.
> > +
> > +To actually get U-Boot to output this you need to also set the default logging
> > +level - e.g. set CONFIG_LOG_DEFAULT_LEVEL to 7 or more.
>
> Why should CONFIG_LOG_DEFAULT_LEVEL be 7 or more?

I'll add a comment about that. I suspect there is a way to avoid this
but so far I have not figured it out.

[..]

Regards,
Simon


More information about the U-Boot mailing list