fix {depth} display, warnings and doc
- fix call stack depth display with {depth}: remove (5) stripped depths.
- fix warnings in tests
- Explain CLUTCHLOG_HAVE_UNIX_SYSINFO in the README.
This commit is contained in:
parent
6123490af6
commit
44ffe6309a
4 changed files with 63 additions and 2 deletions
42
tests/t-assert.cpp
Normal file
42
tests/t-assert.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
#include "../clutchlog/clutchlog.h"
|
||||
|
||||
// Make asserts (de)clutchable.
|
||||
#define ASSERT(LEVEL, ...) { CLUTCHFUNC(LEVEL, assert, __VA_ARGS__) }
|
||||
|
||||
void h()
|
||||
{
|
||||
CLUTCHLOG(info, "!");
|
||||
ASSERT(info, true == true);
|
||||
std::clog << "--" << std::endl;
|
||||
}
|
||||
|
||||
void g()
|
||||
{
|
||||
CLUTCHLOG(warning, "world");
|
||||
ASSERT(warning, strcmp("life","life") == 0);
|
||||
h();
|
||||
}
|
||||
|
||||
void f()
|
||||
{
|
||||
CLUTCHLOG(error, "hello ");
|
||||
ASSERT(error, strcmp("no more","please")!=0);
|
||||
g();
|
||||
}
|
||||
|
||||
int main(/*const int argc, char* argv[]*/)
|
||||
{
|
||||
auto& log = clutchlog::logger();
|
||||
|
||||
log.func("f");
|
||||
f();
|
||||
|
||||
log.func("g");
|
||||
f();
|
||||
|
||||
log.func("h");
|
||||
f();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue