clutchlog 0.17
t-assert.cpp
1#include <iostream>
2#include <cassert>
3#include <cstring>
4
5#include "../clutchlog/clutchlog.h"
6
7// Make asserts (de)clutchable.
8#define ASSERT(...) CLUTCHFUNC(error, assert, __VA_ARGS__);
9
10void h()
11{
12 CLUTCHLOG(info, "!");
13 ASSERT(true == true);
14 std::clog << "--" << std::endl;
15}
16
17void g()
18{
19 CLUTCHLOG(warning, "world");
20 ASSERT(strcmp("life","life") == 0);
21 h();
22}
23
24void f()
25{
26 CLUTCHLOG(error, "hello ");
27 ASSERT(strcmp("no more","please")!=0);
28 g();
29}
30
31int main(/*const int argc, char* argv[]*/)
32{
33 auto& log = clutchlog::logger();
34
35 log.func("f");
36 f();
37
38 log.func("g");
39 f();
40
41 log.func("h");
42 f();
43}
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