blob: a09fc648a85b1fca95c877226b7529582bb513a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <debug.hpp>
TraceLog::TraceLog(const char* tag, ::std::string info, ::std::function<void(::std::ostream&)> ret):
m_tag(tag),
m_ret(ret)
{
if(debug_enabled()) {
auto& os = debug_output(g_debug_indent_level, m_tag);
os << ">> (" << info << ")" << ::std::endl;
}
INDENT();
}
TraceLog::TraceLog(const char* tag, ::std::string info):
m_tag(tag),
m_ret([](const auto&){})
{
if(debug_enabled()) {
auto& os = debug_output(g_debug_indent_level, m_tag);
os << ">> (" << info << ")" << ::std::endl;
}
INDENT();
}
TraceLog::TraceLog(const char* tag):
m_tag(tag),
m_ret([](const auto&){})
{
if(debug_enabled()) {
auto& os = debug_output(g_debug_indent_level, m_tag);
os << ">>" << ::std::endl;
}
INDENT();
}
TraceLog::~TraceLog() {
UNINDENT();
if(debug_enabled()) {
auto& os = debug_output(g_debug_indent_level, m_tag);
os << "<< (";
m_ret(os);
os << ")" << ::std::endl;
}
}
|