Added "clone()" support to loggers

This commit is contained in:
gabime
2018-08-25 17:55:31 +03:00
parent 91d8869f36
commit 5d7845c138
8 changed files with 21 additions and 17 deletions

View File

@@ -161,6 +161,18 @@ void daily_example()
---
#### Periodic flush
```c++
// clone a logger and give it new name.
// Useful for creating subsystem loggers from some "root" logger
void clone_example()
{
auto network_logger = spdlog::get("console")->clone("network");
network_logger->info("Logging network stuff..");
}
```
---
#### Cloning loggers for
```c++
// periodically flush all *registered* loggers every 3 seconds:
// warning: only use if all your loggers are thread safe!
spdlog::flush_every(std::chrono::seconds(3));