Unverified Commit c6d558b6 authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Update README.md

parent 755ce0a0
...@@ -137,15 +137,17 @@ void daily_example() ...@@ -137,15 +137,17 @@ void daily_example()
``` ```
--- ---
#### Cloning loggers #### Backtrace support
```c++ ```c++
// clone a logger and give it new name. // Loggers can store in a ring buffer all messages (including debug/trace) for later inspection.
// Useful for creating subsystem loggers from some "root" logger // When needed, call dump_backtrace() to see what happened:
void clone_example() spdlog::enable_backtrace(32); // create ring buffer with capacity of 32 messages
for(int i = 0; i < 100; i++)
{ {
auto network_logger = spdlog::get("root")->clone("network"); spdlog::debug("Backtrace message {}", i); // not logged yet..
network_logger->info("Logging network stuff..");
} }
// e.g. if some error happened:
spdlog::dump_backtrace(); // log them now!
``` ```
--- ---
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment