clutchlog 0.17
t-depth-delta.cpp
1#include <iostream>
2#include <limits>
3
4#include "../clutchlog/clutchlog.h"
5
6void 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
13void 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
21void 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
29void 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
37int 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
Color and style formatter for ANSI terminal escape sequences.
Definition: clutchlog.h:380
typo
Typographic style codes.
Definition: clutchlog.h:393
static clutchlog & logger()
Get the logger instance.
Definition: clutchlog.h:307
#define CLUTCHLOGD(LEVEL, WHAT, DEPTH_DELTA)
Log a message at the given level and with a given depth delta.
Definition: clutchlog.h:82
#define CLUTCHLOG(LEVEL, WHAT)
Log a message at the given level.
Definition: clutchlog.h:99