From 7fc25bc32547277c38bbedceb39c454843af8aac Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 22 Jun 2020 19:06:48 +1000 Subject: Replace ExitTrace with new DUTIL_CALLBACK_TRACEERROR callback. This allows capturing internal dutil errors and eventually supports filtering to certain parts of dutil. Add Exit...Source macros to simplify calling both TraceError/TraceErrorDebug and Dutil_TraceErrorSource. Make existing Exit macros call the new Exit...Source macros so the logic is in one place. --- src/dutil/inc/logutil.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/dutil/inc/logutil.h') diff --git a/src/dutil/inc/logutil.h b/src/dutil/inc/logutil.h index ee0cd065..426506ee 100644 --- a/src/dutil/inc/logutil.h +++ b/src/dutil/inc/logutil.h @@ -6,9 +6,11 @@ extern "C" { #endif -#define LogExitOnFailure(x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; } +#define LogExitOnFailureSource(d, x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } +#define LogExitOnRootFailureSource(d, x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } -#define LogExitOnRootFailure(x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, f, __VA_ARGS__); goto LExit; } +#define LogExitOnFailure(x, i, f, ...) LogExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, i, f, __VA_ARGS__) +#define LogExitOnRootFailure(x, i, f, ...) LogExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, i, f, __VA_ARGS__) typedef HRESULT (DAPI *PFN_LOGSTRINGWORKRAW)( __in_z LPCSTR szString, -- cgit v1.2.3-55-g6feb