mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 11:29:01 +08:00
Added "clone()" support to loggers
This commit is contained in:
12
README.md
12
README.md
@@ -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));
|
||||
|
Reference in New Issue
Block a user