diff --git a/c11logtest/c11logtest/c11logtest.vcxproj b/c11logtest/c11logtest/c11logtest.vcxproj index 811e7b19..6b357b8a 100644 --- a/c11logtest/c11logtest/c11logtest.vcxproj +++ b/c11logtest/c11logtest/c11logtest.vcxproj @@ -99,6 +99,7 @@ + diff --git a/c11logtest/c11logtest/c11logtest.vcxproj.filters b/c11logtest/c11logtest/c11logtest.vcxproj.filters index c0deacb9..ef86bb8c 100644 --- a/c11logtest/c11logtest/c11logtest.vcxproj.filters +++ b/c11logtest/c11logtest/c11logtest.vcxproj.filters @@ -78,6 +78,9 @@ Header Files\c11log\sinks + + Header Files\c11log\details + diff --git a/example/example.cpp b/example/example.cpp index 85717f3d..7bc9ebe9 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -5,7 +5,7 @@ #include "c11log/sinks/async_sink.h" #include "c11log/sinks/file_sinks.h" #include "c11log/sinks/console_sinks.h" - +#include "c11log/sinks/null_sink.h" #include "utils.h" using std::cout; @@ -16,12 +16,12 @@ using namespace utils; int main(int argc, char* argv[]) { - const unsigned int howmany = argc <= 1 ? 5000000:atoi(argv[1]); + const unsigned int howmany = argc <= 1 ? 10000:atoi(argv[1]); logger cout_logger ("example", sinks::stdout_sink()); cout_logger.info() << "Hello logger"; - auto nullsink = sinks::null_sink::get(); + auto nullsink = std::make_shared(); //auto fsink = std::make_shared("log", "txt", 1024*1024*50 , 5, 0); //auto as = std::make_shared(1000); //as->add_sink(fsink); @@ -32,6 +32,7 @@ int main(int argc, char* argv[]) auto start = system_clock::now(); for (unsigned int i = 1; i <= howmany; ++i) my_logger.info() << "Hello logger: msg #" << i; + my_logger.info("FFF"); //as->shutdown(std::chrono::milliseconds(15000)); auto delta = system_clock::now() - start; diff --git a/include/c11log/sinks/base_sink.h b/include/c11log/sinks/base_sink.h index 5382d213..593cb9b7 100644 --- a/include/c11log/sinks/base_sink.h +++ b/include/c11log/sinks/base_sink.h @@ -43,18 +43,6 @@ protected: std::atomic _enabled; }; -class null_sink:public base_sink -{ -public: - static std::shared_ptr& get() - { - static auto inst = std::make_shared(); - return inst; - } -protected: - void _sink_it(const details::log_msg&) override - {} -}; } diff --git a/include/c11log/sinks/console_sinks.h b/include/c11log/sinks/console_sinks.h index e0004456..27210260 100644 --- a/include/c11log/sinks/console_sinks.h +++ b/include/c11log/sinks/console_sinks.h @@ -43,5 +43,7 @@ inline std::shared_ptr& stderr_sink () return inst; } + + } } diff --git a/include/c11log/sinks/null_sink.h b/include/c11log/sinks/null_sink.h new file mode 100644 index 00000000..9248533b --- /dev/null +++ b/include/c11log/sinks/null_sink.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include "base_sink.h" + +namespace c11log { +namespace sinks { +class null_sink : public base_sink +{ +protected: + void _sink_it(const details::log_msg&) override + {} +}; + +} +} +