diff options
Diffstat (limited to 'src/include/debug.hpp')
-rw-r--r-- | src/include/debug.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/debug.hpp b/src/include/debug.hpp index 012ef1bb..4da63192 100644 --- a/src/include/debug.hpp +++ b/src/include/debug.hpp @@ -24,3 +24,27 @@ struct RepeatLitStr } }; +class TraceLog +{ + static unsigned int depth; + const char* m_tag; +public: + TraceLog(const char* tag): m_tag(tag) { indent(); ::std::cout << ">> " << m_tag << ::std::endl; } + ~TraceLog() { outdent(); ::std::cout << "<< " << m_tag << ::std::endl; } +private: + void indent() + { + for(unsigned int i = 0; i < depth; i ++) + ::std::cout << " "; + depth ++; + } + void outdent() + { + depth --; + for(unsigned int i = 0; i < depth; i ++) + ::std::cout << " "; + } +}; +#define TRACE_FUNCTION TraceLog _tf_(__func__) + + |