log: force DEBUG when LOG_DEBUG is activated
When CONFIG_LOG is activated, if LOG_DEBUG is defined in a file and DEBUG is not defined the trace with debug() macro are not displayed, because the parameter cond : _DEBUG = 0 is checked in debug_cond(). With this patch the define DEBUG, used to force the trace generated by debug() macro, is linked with the define LOG_DEBUG, used to force the trace generated by other macros (log_debug, dev_dbg, pr_debug). We only need to define LOG_DEBUG in a file to activate all the traces generated by any U-Boot debug macro, as it is described in /doc/develop/logging.rst Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
parent
de84a4f0ee
commit
54e89a8beb
@ -66,26 +66,21 @@ Sometimes it is useful to turn on logging just in one file. You can use this
|
|||||||
#define LOG_DEBUG
|
#define LOG_DEBUG
|
||||||
|
|
||||||
to enable building in of all logging statements in a single file. Put it at
|
to enable building in of all logging statements in a single file. Put it at
|
||||||
the top of the file, before any #includes.
|
the top of the file, before any #includes and any message in the file will be
|
||||||
|
written, regardless of the value of CONFIG_LOG_DEFAULT_LEVEL.
|
||||||
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 (:c:data:`LOGL_DEBUG`) or more.
|
|
||||||
Otherwise debug output is suppressed and will not be generated.
|
|
||||||
|
|
||||||
Using DEBUG
|
Using DEBUG
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
U-Boot has traditionally used a #define called DEBUG to enable debugging on a
|
U-Boot has traditionally used a #define called DEBUG to enable debugging on a
|
||||||
file-by-file basis. The debug() macro compiles to a printf() statement if
|
file-by-file basis but LOG_DEBUG are intended to replace it with the logging
|
||||||
DEBUG is enabled, and an empty statement if not.
|
facilities; DEBUG is activated when LOG_DEBUG is activated.
|
||||||
|
|
||||||
With logging enabled, debug() statements are interpreted as logging output
|
With logging enabled, debug() statements are interpreted as logging output
|
||||||
with a level of LOGL_DEBUG and a category of LOGC_NONE.
|
with a level of LOGL_DEBUG and a category of LOG_CATEGORY.
|
||||||
|
|
||||||
The logging facilities are intended to replace DEBUG, but if DEBUG is defined
|
With logging disabled, the debug() macro compiles to a printf() statement
|
||||||
at the top of a file, then it takes precedence. This means that debug()
|
if DEBUG is enabled and to an empty statement if not.
|
||||||
statements will result in output to the console and this output will not be
|
|
||||||
logged.
|
|
||||||
|
|
||||||
Logging statements
|
Logging statements
|
||||||
------------------
|
------------------
|
||||||
|
@ -194,6 +194,9 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
|
|||||||
|
|
||||||
#ifdef LOG_DEBUG
|
#ifdef LOG_DEBUG
|
||||||
#define _LOG_DEBUG LOGL_FORCE_DEBUG
|
#define _LOG_DEBUG LOGL_FORCE_DEBUG
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define _LOG_DEBUG 0
|
#define _LOG_DEBUG 0
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user