From dc558da002794cc07013e8376f3c55c73391aa0e Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 12 Jul 2020 17:07:55 +1000 Subject: Update Dutil_TraceErrorSource to filter based on the report level. --- src/dutil/dutil.cpp | 6 ++++++ src/dutil/inc/dutil.h | 13 +------------ src/dutil/inc/dutilsources.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'src/dutil') diff --git a/src/dutil/dutil.cpp b/src/dutil/dutil.cpp index a32de516..99ce1bc6 100644 --- a/src/dutil/dutil.cpp +++ b/src/dutil/dutil.cpp @@ -408,6 +408,12 @@ DAPIV_(void) Dutil_TraceErrorSource( ... ) { + // if this is NOT an error report and we're not logging at this level, bail + if (REPORT_ERROR != rl && Dutil_rlCurrentTrace < rl) + { + return; + } + if (DUTIL_SOURCE_UNKNOWN != source && vpfnTraceErrorCallback) { va_list args; diff --git a/src/dutil/inc/dutil.h b/src/dutil/inc/dutil.h index 6b57b48a..15d45d21 100644 --- a/src/dutil/inc/dutil.h +++ b/src/dutil/inc/dutil.h @@ -10,17 +10,6 @@ #define DAPIV_(type) EXTERN_C type DAPIV -// enums -typedef enum REPORT_LEVEL -{ - REPORT_NONE, // turns off report (only valid for XXXSetLevel()) - REPORT_WARNING, // written if want only warnings or reporting is on in general - REPORT_STANDARD, // written if reporting is on - REPORT_VERBOSE, // written only if verbose reporting is on - REPORT_DEBUG, // reporting useful when debugging code - REPORT_ERROR, // always gets reported, but can never be specified -} REPORT_LEVEL; - // asserts and traces typedef BOOL (DAPI *DUTIL_ASSERTDISPLAYFUNCTION)(__in_z LPCSTR sz); @@ -29,7 +18,7 @@ typedef void (CALLBACK *DUTIL_CALLBACK_TRACEERROR)( __in int iLine, __in REPORT_LEVEL rl, __in UINT source, - __in HRESULT hr, + __in HRESULT hrError, __in_z __format_string LPCSTR szFormat, __in va_list args ); diff --git a/src/dutil/inc/dutilsources.h b/src/dutil/inc/dutilsources.h index bf3da16f..b03013ca 100644 --- a/src/dutil/inc/dutilsources.h +++ b/src/dutil/inc/dutilsources.h @@ -63,3 +63,13 @@ typedef enum DUTIL_SOURCE DUTIL_SOURCE_EXTERNAL = 256, } DUTIL_SOURCE; + +typedef enum REPORT_LEVEL +{ + REPORT_NONE, // turns off report (only valid for XXXSetLevel()) + REPORT_WARNING, // written if want only warnings or reporting is on in general + REPORT_STANDARD, // written if reporting is on + REPORT_VERBOSE, // written only if verbose reporting is on + REPORT_DEBUG, // reporting useful when debugging code + REPORT_ERROR, // always gets reported, but can never be specified +} REPORT_LEVEL; -- cgit v1.2.3-55-g6feb