Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gabime/spdlog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgabime <gmelman1@gmail.com>2019-08-27 01:51:59 +0300
committergabime <gmelman1@gmail.com>2019-08-27 01:51:59 +0300
commit72b0f9e8f729cecf44d699c409cc98fc01a9d264 (patch)
tree6ee4897fc6e685fdae3488a59591b5f0db1269cd /example
parent408a1620447e69ffda61568fd6595fd2716ba1f7 (diff)
Updated example
Diffstat (limited to 'example')
-rw-r--r--example/example.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/example/example.cpp b/example/example.cpp
index 9a070c1e..144e0401 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -40,6 +40,18 @@ int main(int, char *[])
spdlog::set_pattern("[%H:%M:%S %z] [%^%L%$] [thread %t] %v");
spdlog::info("This an info message with custom format");
spdlog::set_pattern("%+"); // back to default format
+ spdlog::set_level(spdlog::level::info);
+
+ // Backtrace support
+ // 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(10); // create ring buffer with capacity of 10 messages
+ for(int i = 0; i < 100; i++)
+ {
+ spdlog::debug("Backtrace message {}", i); // not logged..
+ }
+ // e.g. if some error happened:
+ spdlog::dump_backtrace(); // log them now!
try
{