helper/log: add LOG_CUSTOM_LEVEL() macro
Allow logging at a changeable level. Add an example of usage in ftdi driver. Log SWD commands with not OK response at debug level (3). For commands which responded OK use debug io level (4) not to flood the log. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I67a472b293f7ed9ee84cadb7c081803e9eeb1ad0 Reviewed-on: https://review.openocd.org/c/openocd/+/8151 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Antonio Borneo
parent
263dbc1472
commit
b63e065f23
@@ -114,6 +114,15 @@ extern int debug_level;
|
||||
expr); \
|
||||
} while (0)
|
||||
|
||||
#define LOG_CUSTOM_LEVEL(level, expr ...) \
|
||||
do { \
|
||||
enum log_levels _level = level; \
|
||||
if (debug_level >= _level) \
|
||||
log_printf_lf(_level, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
expr); \
|
||||
} while (0)
|
||||
|
||||
#define LOG_INFO(expr ...) \
|
||||
log_printf_lf(LOG_LVL_INFO, __FILE__, __LINE__, __func__, expr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user