summaryrefslogtreecommitdiff
path: root/src/include/debug.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/debug.hpp')
-rw-r--r--src/include/debug.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/include/debug.hpp b/src/include/debug.hpp
index 3f059301..534523c2 100644
--- a/src/include/debug.hpp
+++ b/src/include/debug.hpp
@@ -14,13 +14,18 @@
extern int g_debug_indent_level;
+#ifndef DEBUG_EXTRA_ENABLE
+# define DEBUG_EXTRA_ENABLE // Files can override this with their own flag if needed (e.g. `&& g_my_debug_on`)
+#endif
+
#ifndef DISABLE_DEBUG
+# define DEBUG_ENABLED (debug_enabled() DEBUG_EXTRA_ENABLE)
# define INDENT() do { g_debug_indent_level += 1; assert(g_debug_indent_level<300); } while(0)
# define UNINDENT() do { g_debug_indent_level -= 1; } while(0)
-# define DEBUG(ss) do{ if(debug_enabled()) { debug_output(g_debug_indent_level, __FUNCTION__) << ss << ::std::endl; } } while(0)
-# define TRACE_FUNCTION TraceLog _tf_(__func__)
-# define TRACE_FUNCTION_F(ss) TraceLog _tf_(__func__, [&](::std::ostream&__os){ __os << ss; })
-# define TRACE_FUNCTION_FR(ss,ss2) TraceLog _tf_(__func__, [&](::std::ostream&__os){ __os << ss; }, [&](::std::ostream&__os){ __os << ss2;})
+# define DEBUG(ss) do{ if(DEBUG_ENABLED) { debug_output(g_debug_indent_level, __FUNCTION__) << ss << ::std::endl; } } while(0)
+# define TRACE_FUNCTION TraceLog _tf_( DEBUG_ENABLED ? __func__ : nullptr)
+# define TRACE_FUNCTION_F(ss) TraceLog _tf_(DEBUG_ENABLED ? __func__ : nullptr, [&](::std::ostream&__os){ __os << ss; })
+# define TRACE_FUNCTION_FR(ss,ss2) TraceLog _tf_(DEBUG_ENABLED ? __func__ : nullptr, [&](::std::ostream&__os){ __os << ss; }, [&](::std::ostream&__os){ __os << ss2;})
#else
# define INDENT() do { } while(0)
# define UNINDENT() do {} while(0)