From d6cc5847fa3bd9b13fb8d36916d2dd85fd3dfefe Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 13 Aug 2018 12:37:15 +0300 Subject: [PATCH] Udpated README --- README.md | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1f8cc97f..af04f85a 100644 --- a/README.md +++ b/README.md @@ -166,20 +166,7 @@ spdlog::flush_every(std::chrono::seconds(3)); ``` ---- -#### Asynchronous logging -```c++ -#include "spdlog/async.h" -void async_example() -{ - // default thread pool settings can be modified *before* creating the async logger: - // spdlog::init_thread_pool(8192, 1); // queue with 8k items and 1 backing thread. - auto async_file = spdlog::basic_logger_mt("async_file_logger", "logs/async_log.txt"); - // alternatively: - // auto async_file = spdlog::create_async("async_file_logger", "logs/async_log.txt"); -} -``` --- #### Logger with multi sinks - each with different format and log level ```c++ @@ -203,9 +190,29 @@ void multi_sink_example() ``` --- -#### Async logger with multi sinks +#### Asynchronous logging +```c++ +#include "spdlog/async.h" +#include "spdlog/sinks/basic_file_sink.h" +void async_example() +{ + // default thread pool settings can be modified *before* creating the async logger: + // spdlog::init_thread_pool(8192, 1); // queue with 8k items and 1 backing thread. + auto async_file = spdlog::basic_logger_mt("async_file_logger", "logs/async_log.txt"); + // alternatively: + // auto async_file = spdlog::create_async("async_file_logger", "logs/async_log.txt"); +} + +``` + +--- +#### Asynchronous logger with multi sinks ```c++ // create asynchronous logger with 2 sinks. + +#include "spdlog/sinks/stdout_color_sinks.h" +#include "spdlog/sinks/rotating_file_sink.h" + void multi_sink_example2() { spdlog::init_thread_pool(8192, 1);