From 167f5a61e553ab48048870943224228d8fb9bc3a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 10 Jul 2019 19:36:54 +1000 Subject: C Logging: add macro to check if logging is enabled --- intern/clog/CLG_log.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h index 1d78c401924..7418623755c 100644 --- a/intern/clog/CLG_log.h +++ b/intern/clog/CLG_log.h @@ -158,6 +158,10 @@ void CLG_logref_init(CLG_LogRef *clg_ref); #define CLOG_ENSURE(clg_ref) \ ((clg_ref)->type ? (clg_ref)->type : (CLG_logref_init(clg_ref), (clg_ref)->type)) +#define CLOG_CHECK(clg_ref, verbose_level, ...) \ + ((void)CLOG_ENSURE(clg_ref), \ + ((clg_ref)->type->flag & CLG_FLAG_USE) && ((clg_ref)->type->level >= verbose_level)) + #define CLOG_AT_SEVERITY(clg_ref, severity, verbose_level, ...) \ { \ CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \ -- cgit v1.2.3