clutchlog
0.16
t-depth-delta.cpp
1
#include <iostream>
2
#include <limits>
3
4
#include "../clutchlog/clutchlog.h"
5
6
void
deepcall()
7
{
8
CLUTCHLOG
(warning,
"at depth 4"
);
9
CLUTCHLOGD
(warning,
"at depth 4+1"
, 1);
10
CLUTCHLOGD
(warning,
"at depth 4+2"
, 2);
11
}
12
13
void
subsubsubcall()
14
{
15
CLUTCHLOG
(warning,
"at depth 3"
);
16
CLUTCHLOGD
(warning,
"at depth 3+1"
, 1);
17
CLUTCHLOGD
(warning,
"at depth 3+2"
, 2);
18
deepcall();
19
}
20
21
void
subsubcall()
22
{
23
CLUTCHLOG
(warning,
"at depth 2"
);
24
CLUTCHLOGD
(warning,
"at depth 2+1"
, 1);
25
CLUTCHLOGD
(warning,
"at depth 2+2"
, 2);
26
subsubsubcall();
27
}
28
29
void
subcall()
30
{
31
CLUTCHLOG
(warning,
"at depth 1"
);
32
CLUTCHLOGD
(warning,
"at depth 1+1"
, 1);
33
CLUTCHLOGD
(warning,
"at depth 1+2"
, 2);
34
subsubcall();
35
}
36
37
int
main(
/*const int argc, char* argv[]*/
)
38
{
39
auto
& log =
clutchlog::logger
();
40
using
fmt =
clutchlog::fmt
;
41
using
typo =
clutchlog::fmt::typo
;
42
43
fmt reset(typo::reset);
44
std::ostringstream tpl;
45
tpl <<
"{depth_fmt}{depth} {depth_marks}"
46
<< reset <<
"{funchash_fmt}in {func} {msg}\t\n"
;
47
log.format(tpl.str());
48
log.threshold(clutchlog::level::xdebug);
49
std::vector<fmt> greys = {fmt(15)};
50
for
(
unsigned
short
i=255; i > 231; i-=3) {
51
greys.push_back( fmt(i) ); }
52
log.depth_styles( greys );
53
log.depth_mark(
"| "
);
54
55
CLUTCHLOG
(warning,
"in main"
);
56
subcall();
57
}
58
CLUTCHLOGD
#define CLUTCHLOGD(LEVEL, WHAT, DEPTH_DELTA)
Log a message at the given level and with a given depth delta.
Definition:
clutchlog.h:81
clutchlog::logger
static clutchlog & logger()
Get the logger instance.
Definition:
clutchlog.h:306
clutchlog::fmt
Color and style formatter for ANSI terminal escape sequences.
Definition:
clutchlog.h:379
CLUTCHLOG
#define CLUTCHLOG(LEVEL, WHAT)
Log a message at the given level.
Definition:
clutchlog.h:98
clutchlog::fmt::typo
typo
Typographic style codes.
Definition:
clutchlog.h:392
tests
t-depth-delta.cpp
Generated by
1.8.17