blob: d460c3cb6d6b10fe2f01b56375689494e1b1b7d4 (
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
43
44
45
46
|
#include <debug.hpp>
TraceLog::TraceLog(const char* tag, ::std::function<void(::std::ostream&)> info_cb, ::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_cb(os);
os << ")" << ::std::endl;
}
INDENT();
}
TraceLog::TraceLog(const char* tag, ::std::function<void(::std::ostream&)> info_cb):
m_tag(tag),
m_ret([](const auto&){})
{
if(debug_enabled()) {
auto& os = debug_output(g_debug_indent_level, m_tag);
os << ">> (";
info_cb(os);
os << ")" << ::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;
}
}
|