refactor msg formatting, add CLUTCHDUMP

- remove show_* methods.
This commit is contained in:
Johann Dreo 2020-08-30 23:30:00 +02:00
commit 819a2ebf15
4 changed files with 195 additions and 68 deletions

62
tests/t-log.cpp Normal file
View file

@ -0,0 +1,62 @@
#include <iostream>
#include "../clutchlog/clutchlog.h"
void h()
{
CLUTCHLOG(info, "!");
std::clog << "--" << std::endl;
}
void g()
{
CLUTCHLOG(warning, "world");
h();
}
void f()
{
CLUTCHLOG(error, "hello ");
g();
}
int main(/*const int argc, char* argv[]*/)
{
#ifdef WITH_CLUTCHLOG
auto& log = clutchlog::logger();
log.out(std::clog);
std::clog << "depth: 99; threshold: xdebug; location: .*" << std::endl;
log.depth(99);
log.threshold(clutchlog::level::xdebug);
log.location(".*",".*");
f();
std::clog << "depth: 4; threshold: xdebug; location: ,*" << std::endl;
log.depth(4);
log.threshold(clutchlog::level::xdebug);
log.location(".*");
f();
std::clog << "depth: 99; threshold: warning; location: .*" << std::endl;
log.depth(99);
log.threshold(clutchlog::level::warning);
log.location(".*");
f();
std::clog << "depth: 99; threshold: xdebug; location: 'core','g'" << std::endl;
log.depth(99);
log.threshold(clutchlog::level::xdebug);
log.location("core","g");
f();
std::clog << "depth: 99; threshold: debug; location: '.*','(g|h)'" << std::endl;
log.depth(99);
log.threshold(clutchlog::level::debug);
log.location(".*","(g|h)");
f();
#endif
}