summaryrefslogtreecommitdiff
path: root/include/log.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-02-17 06:24:37 +0300
committerBin Meng <bmeng.cn@gmail.com>2019-02-20 10:21:44 +0300
commitf9811e8575eb42e75c615ba9b44f0481cdb78330 (patch)
tree8eb5ef4d0bb4529d4bb2d017310881023e8273b7 /include/log.h
parent8dee7b96fd6eaea54400aaf317f72aac9b323b58 (diff)
downloadu-boot-f9811e8575eb42e75c615ba9b44f0481cdb78330.tar.xz
log: Allow #define LOG_DEBUG to enable logging in a file
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@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/log.h b/include/log.h
index 33e99ab703..7566ba7f2d 100644
--- a/include/log.h
+++ b/include/log.h
@@ -111,11 +111,16 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
#endif
#if CONFIG_IS_ENABLED(LOG)
+#ifdef LOG_DEBUG
+#define _LOG_DEBUG 1
+#else
+#define _LOG_DEBUG 0
+#endif
/* Emit a log record if the level is less that the maximum */
#define log(_cat, _level, _fmt, _args...) ({ \
int _l = _level; \
- if (CONFIG_IS_ENABLED(LOG) && _l <= _LOG_MAX_LEVEL) \
+ if (CONFIG_IS_ENABLED(LOG) && (_l <= _LOG_MAX_LEVEL || _LOG_DEBUG)) \
_log((enum log_category_t)(_cat), _l, __FILE__, __LINE__, \
__func__, \
pr_fmt(_fmt), ##_args); \