From 1fd166d4173b49638dd51188088407216f6911ad Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 8 Jul 2018 16:26:14 +0300 Subject: [PATCH] Updated example --- example/example.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index 1ee4c003..c848141d 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -131,22 +131,22 @@ void async_example() } } -// create logger with 2 targets with different log levels and formats +// create logger with 2 targets with different log levels and formats +// the console will show only warnings or errors, while the file will log all void multi_sink_example() { - - auto console_sink = std::make_shared(); + auto console_sink = std::make_shared(); console_sink->set_level(spdlog::level::warn); console_sink->set_pattern("[multi_sink_example] [%^%l%$] %v"); - auto file_sink = std::make_shared("logs/multisink.txt", true); - file_sink->set_level(spdlog::level::info); + auto file_sink = std::make_shared("logs/multisink.txt", true); + file_sink->set_level(spdlog::level::trace); spdlog::logger logger("multi_sink", {console_sink, file_sink}); + logger.set_level(spdlog::level::debug); logger.warn("this should appear in both console and file"); logger.info("this message should not appear in the console, only in the file"); - } // user defined types logging by implementing operator<< #include "spdlog/fmt/ostr.h" // must be included