add level prefix letter, refactor test
This commit is contained in:
parent
7ae6c40d27
commit
b3a04a88a7
2 changed files with 63 additions and 14 deletions
|
|
@ -1,34 +1,65 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "../clutchlog/clutchlog.h"
|
||||
|
||||
void h()
|
||||
{
|
||||
CLUTCHLOG(info, "!");
|
||||
std::clog << "--" << std::endl;
|
||||
}
|
||||
|
||||
void g()
|
||||
{
|
||||
CLUTCHLOG(info, "!");
|
||||
CLUTCHLOG(warning, "world");
|
||||
h();
|
||||
}
|
||||
|
||||
void f()
|
||||
{
|
||||
CLUTCHLOG(warning, "world");
|
||||
CLUTCHLOG(error, "hello ");
|
||||
g();
|
||||
}
|
||||
|
||||
int main(const int argc, char* argv[])
|
||||
int main(/*const int argc, char* argv[]*/)
|
||||
{
|
||||
#ifdef WITH_CLUTCHLOG
|
||||
|
||||
auto& log = clutchlog::logger();
|
||||
|
||||
log.out(std::clog);
|
||||
|
||||
size_t below = 2;
|
||||
if(argc >= 2) { below = atoi(argv[1]); }
|
||||
log.depth(below);
|
||||
|
||||
log.threshold(clutchlog::level::warning);
|
||||
|
||||
log.file("core");
|
||||
log.func("(main|f)");
|
||||
#endif
|
||||
|
||||
CLUTCHLOG(error, "hello " << argc);
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue