Wrap `main` content in try block for exception safety.

fix-warnings
gabime 4 months ago
parent a9e09baeec
commit 6c174aa5b7

@ -33,6 +33,7 @@ void mdc_example();
#include "spdlog/fmt/ostr.h" // support for user defined types
int main(int, char *[]) {
try {
// Log levels can be loaded from argv/env using "SPDLOG_LEVEL"
load_levels_example();
@ -58,8 +59,8 @@ int main(int, char *[]) {
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:
// 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..
@ -67,7 +68,6 @@ int main(int, char *[]) {
// e.g. if some error happened:
spdlog::dump_backtrace(); // log them now!
try {
stdout_logger_example();
basic_example();
rotating_example();

Loading…
Cancel
Save