clutchlog 0.17
t-hash-color.cpp
1#include <iostream>
2#include <limits>
3
4#include "../clutchlog/clutchlog.h"
5
6void deepcall()
7{
8 CLUTCHLOG(warning,"at depth 4");
9}
10
11void subsubsubcall()
12{
13 CLUTCHLOG(warning,"at depth 3");
14 deepcall();
15}
16
17void subsubcall()
18{
19 CLUTCHLOG(warning,"at depth 2");
20 subsubsubcall();
21}
22
23void subcall()
24{
25 CLUTCHLOG(warning,"at depth 1");
26 subsubcall();
27}
28
29int main(/*const int argc, char* argv[]*/)
30{
31 auto& log = clutchlog::logger();
32 using fmt = clutchlog::fmt;
33 using typo = clutchlog::fmt::typo;
34
35 fmt reset(typo::reset);
36 std::ostringstream tpl;
37 tpl << "{level_fmt}Having a {level} {filehash_fmt}within {file} {funchash_fmt}calling {func} {depth_fmt}at depth {depth_marks} {depth} "
38 << reset << " : {msg}\n";
39 log.format(tpl.str());
40 log.threshold(clutchlog::level::xdebug);
41
42 log.filehash_styles( {fmt(fmt::fg::red), fmt(fmt::fg::yellow)} );
43 log.funchash_styles( {fmt(fmt::fg::green), fmt(fmt::fg::blue),
44 fmt(fmt::fg::bright_green), fmt(fmt::fg::bright_blue), fmt(fmt::fg::magenta)} );
45 log.depth_styles( {fmt(255),fmt(250),fmt(245),fmt(240)} );
46
47 CLUTCHLOG(warning,"in main");
48 subcall();
49}
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 CLUTCHLOG(LEVEL, WHAT)
Log a message at the given level.
Definition: clutchlog.h:99