From c6d558b6f26287a4b3cd06e2d9973c082293b13f Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Tue, 27 Aug 2019 02:20:17 +0300 Subject: [PATCH] Update README.md --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4fcef570..af41614f 100644 --- a/README.md +++ b/README.md @@ -137,15 +137,17 @@ void daily_example() ``` --- -#### Cloning loggers +#### Backtrace support ```c++ -// clone a logger and give it new name. -// Useful for creating subsystem loggers from some "root" logger -void clone_example() +// Loggers can store in a ring buffer all messages (including debug/trace) for later inspection. +// When needed, call dump_backtrace() to see what happened: +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"); - network_logger->info("Logging network stuff.."); + spdlog::debug("Backtrace message {}", i); // not logged yet.. } +// e.g. if some error happened: +spdlog::dump_backtrace(); // log them now! ``` ---