aboutsummaryrefslogtreecommitdiff
path: root/src/debugspew.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/debugspew.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/debugspew.h b/src/debugspew.h
index 216f617..ccebc0a 100644
--- a/src/debugspew.h
+++ b/src/debugspew.h
@@ -15,7 +15,7 @@ class DebugSpewIndentScope
15 Universe* const U{}; 15 Universe* const U{};
16 16
17 public: 17 public:
18 static char const* const debugspew_indent; 18 static std::string_view const debugspew_indent;
19 19
20 DebugSpewIndentScope(Universe* U_) 20 DebugSpewIndentScope(Universe* U_)
21 : U{ U_ } 21 : U{ U_ }
@@ -35,12 +35,17 @@ class DebugSpewIndentScope
35 35
36// ################################################################################################# 36// #################################################################################################
37 37
38inline std::string_view DebugSpewIndent(Universe const* const U_)
39{
40 return DebugSpewIndentScope::debugspew_indent.substr(0, static_cast<size_t>(U_->debugspewIndentDepth.load(std::memory_order_relaxed)));
41}
42
38inline auto& DebugSpew(Universe const* const U_) 43inline auto& DebugSpew(Universe const* const U_)
39{ 44{
40 if (!U_) { 45 if (!U_) {
41 return std::cerr; 46 return std::cerr;
42 } 47 }
43 return std::cerr << std::string_view{ DebugSpewIndentScope::debugspew_indent, static_cast<size_t>(U_->debugspewIndentDepth.load(std::memory_order_relaxed)) } << " "; 48 return std::cerr << DebugSpewIndent(U_) << " ";
44} 49}
45#define DEBUGSPEW_CODE(_code) _code 50#define DEBUGSPEW_CODE(_code) _code
46#define DEBUGSPEW_OR_NOT(a_, b_) a_ 51#define DEBUGSPEW_OR_NOT(a_, b_) a_