feat(levels): easier threshold setting.

- Adds `threshold(string)` for easier level setting.
- Adds `levels()` to make it easy to test if a user-defined string is good.
- Move the log levels section up in the readme.
This commit is contained in:
Johann Dreo 2022-08-29 10:24:17 +02:00
commit 76e4782cb0
3 changed files with 79 additions and 64 deletions

View file

@ -38,7 +38,9 @@ int main(/*const int argc, char* argv[]*/)
#if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
log.depth(4);
#endif
log.threshold(clutchlog::level::xdebug);
assert(log.levels().find("XDebug") != std::end(log.levels())); // contains
assert(log.levels().find("Xdebug") == std::end(log.levels())); // not contains
log.threshold("XDebug");
log.location(".*");
f();
@ -62,7 +64,7 @@ int main(/*const int argc, char* argv[]*/)
#if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
log.depth(99);
#endif
log.threshold(clutchlog::level::debug);
log.threshold("Debug");
log.location(".*","(g|h)");
f();
}