[PATCH] 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 ---
include/log.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/log.h b/include/log.h index 8f35c10abb5..7abc70e4398 100644 --- a/include/log.h +++ b/include/log.h @@ -194,6 +194,9 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
#ifdef LOG_DEBUG #define _LOG_DEBUG LOGL_FORCE_DEBUG +#ifndef DEBUG +#define DEBUG +#endif #else #define _LOG_DEBUG 0 #endif

Hi Patrick,
On Thu, 30 Jun 2022 at 11:33, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
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
include/log.h | 3 +++ 1 file changed, 3 insertions(+)
I think this is OK.
Can you please update 'Using DEBUG' in doc/develop/logging.rst ?
Regards, Simon
participants (2)
-
Patrick Delaunay
-
Simon Glass