From 66f955c49910fd6f5ce74dafecad7fb88312e419 Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 21 May 2024 09:15:23 -0700 Subject: [PATCH] Only create a stack trace for STHROW on debug --- libstuff/libstuff.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libstuff/libstuff.h b/libstuff/libstuff.h index e90ea984f..6f5dffd99 100644 --- a/libstuff/libstuff.h +++ b/libstuff/libstuff.h @@ -112,10 +112,12 @@ typedef map STable; // An SException is an exception class that can represent an HTTP-like response, with a method line, headers, and a // body. The STHROW and STHROW_STACK macros will create an SException that logs it's file, line of creation, and -// a stack trace at the same time. They can take, 1, 2, or all 3 of the components of an HTTP response as arguments. +// (for DEBUG) a stack trace at the same time. They can take, 1, 2, or all 3 of the components of an HTTP response as arguments. #define STHROW(...) \ do { \ - SLogStackTrace(LOG_DEBUG); \ + if (_g_SLogMask & (1 << LOG_DEBUG)) { \ + SLogStackTrace(LOG_DEBUG); \ + } \ throw SException(__FILE__, __LINE__, false, __VA_ARGS__); \ } while (false)