|
|
|
@ -146,17 +146,16 @@ void daily_example()
|
|
|
|
|
```c++
|
|
|
|
|
// Debug messages can be stored in a ring buffer instead of being logged immediately.
|
|
|
|
|
// This is useful in order to display debug logs only when really needed (e.g. when error happens).
|
|
|
|
|
// When needed, call dump_backtrace() to see them.
|
|
|
|
|
// When needed, call dump_backtrace() to dump them to your log.
|
|
|
|
|
|
|
|
|
|
spdlog::enable_backtrace(32); // Store the latest 32 messages in a buffer. Older messages will be dropped.
|
|
|
|
|
spdlog::enable_backtrace(32); // Store the latest 32 messages in a buffer.
|
|
|
|
|
// or my_logger->enable_backtrace(32)..
|
|
|
|
|
for(int i = 0; i < 100; i++)
|
|
|
|
|
{
|
|
|
|
|
spdlog::debug("Backtrace message {}", i); // not logged yet..
|
|
|
|
|
}
|
|
|
|
|
// e.g. if some error happened:
|
|
|
|
|
// e.g. if some has error happened:
|
|
|
|
|
spdlog::dump_backtrace(); // log them now! show the last 32 messages
|
|
|
|
|
|
|
|
|
|
// or my_logger->dump_backtrace(32)..
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@ -376,7 +375,7 @@ $ ./example
|
|
|
|
|
#### Log file open/close event handlers
|
|
|
|
|
```c++
|
|
|
|
|
// You can get callbacks from spdlog before/after log file has been opened or closed.
|
|
|
|
|
// This is useful for cleanup procedures or for adding someting the start/end of the log files.
|
|
|
|
|
// This is useful for cleanup procedures or for adding something the start/end of the log files.
|
|
|
|
|
void file_events_example()
|
|
|
|
|
{
|
|
|
|
|
// pass the spdlog::file_event_handlers to file sinks for open/close log file notifications
|
|
|
|
|