From 1d672d39cf0ea62a4f441cad820c4b471b2c6f2b Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 13 Aug 2018 12:33:58 +0300 Subject: [PATCH] Udpated README --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b3afba4..1f8cc97f 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ void async_example() ``` --- -#### Logger with multi targets - each with different format and log level +#### Logger with multi sinks - each with different format and log level ```c++ // create logger with 2 targets with different log levels and formats. @@ -201,6 +201,22 @@ void multi_sink_example() logger.info("this message should not appear in the console, only in the file"); } ``` + +--- +#### Async logger with multi sinks +```c++ +// create asynchronous logger with 2 sinks. +void multi_sink_example2() +{ + spdlog::init_thread_pool(8192, 1); + auto stdout_sink = std::make_shared(); + auto rotating_sink = std::make_shared("mylog.txt", 1024*1024*10, 3); + std::vector sinks {stdout_sink, rotating_sink}; + auto logger = std::make_shared("loggername", sinks.begin(), sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block); + spdlog::register_logger(logger); +} +``` + --- #### User defined types ```c++