From ef330729cb66408f12132aeb294b62d5bd3819c7 Mon Sep 17 00:00:00 2001 From: gabi Date: Tue, 14 Oct 2014 04:29:52 +0300 Subject: [PATCH] moved pattern_formatter to details --- c11logtest/c11logtest/c11logtest.vcxproj | 4 ++-- .../c11logtest/c11logtest.vcxproj.filters | 10 ++++----- example/bench.cpp | 4 ++-- .../c11log/{ => details}/pattern_formatter.h | 22 +++++++++---------- include/c11log/logger.h | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) rename include/c11log/{ => details}/pattern_formatter.h (93%) diff --git a/c11logtest/c11logtest/c11logtest.vcxproj b/c11logtest/c11logtest/c11logtest.vcxproj index a702e84b..a3c4d9d7 100644 --- a/c11logtest/c11logtest/c11logtest.vcxproj +++ b/c11logtest/c11logtest/c11logtest.vcxproj @@ -94,17 +94,17 @@ + - - + diff --git a/c11logtest/c11logtest/c11logtest.vcxproj.filters b/c11logtest/c11logtest/c11logtest.vcxproj.filters index 04ad2d6f..7d6eba11 100644 --- a/c11logtest/c11logtest/c11logtest.vcxproj.filters +++ b/c11logtest/c11logtest/c11logtest.vcxproj.filters @@ -84,17 +84,17 @@ Header Files\c11log - - Header Files\c11log\sinks - Header Files\c11log Header Files\c11log\details - - Header Files\c11log + + Header Files\c11log\sinks + + + Header Files\c11log\details diff --git a/example/bench.cpp b/example/bench.cpp index 882f3e34..9ae162ea 100644 --- a/example/bench.cpp +++ b/example/bench.cpp @@ -27,11 +27,11 @@ int main(int argc, char* argv[]) cout_logger.info() << "Hello logger"; auto nullsink = std::make_shared>(); + auto rotating = std::make_shared("myrotating", "txt", 1024 * 1024 * 5, 5, 100); auto formatter2 = std::unique_ptr(new pattern_formatter(pattern)); - logger my_logger("my_logger", nullsink, std::move(formatter2)); - //logger my_logger("my_logger", nullsink); + logger my_logger("my_logger", rotating, std::move(formatter2)); auto start = system_clock::now(); for (unsigned int i = 1; i <= howmany; ++i) diff --git a/include/c11log/pattern_formatter.h b/include/c11log/details/pattern_formatter.h similarity index 93% rename from include/c11log/pattern_formatter.h rename to include/c11log/details/pattern_formatter.h index 15b2a0f0..cc7d43c1 100644 --- a/include/c11log/pattern_formatter.h +++ b/include/c11log/details/pattern_formatter.h @@ -5,9 +5,9 @@ #include #include -#include "formatter.h" -#include "details/log_msg.h" -#include "details/fast_oss.h" +#include "../formatter.h" +#include "log_msg.h" +#include "fast_oss.h" namespace c11log @@ -46,7 +46,7 @@ class Y_appender :public pattern_appender { void append(const details::log_msg& msg, details::fast_oss& oss) override { - oss.put_int(msg.tm_time.tm_year+1900, 4); + oss.put_int(msg.tm_time.tm_year + 1900, 4); } }; @@ -140,7 +140,7 @@ public: {} void append(const details::log_msg& msg, details::fast_oss& oss) override { - oss.putc( _ch); + oss.putc(_ch); } private: char _ch; @@ -163,7 +163,7 @@ public: private: std::string _str; }; -} + class pattern_formatter : public formatter @@ -180,16 +180,16 @@ private: void compile_pattern(const std::string& pattern); }; } +} - -inline c11log::pattern_formatter::pattern_formatter(const std::string& pattern) +inline c11log::details::pattern_formatter::pattern_formatter(const std::string& pattern) { compile_pattern(pattern); } -inline void c11log::pattern_formatter::compile_pattern(const std::string& pattern) +inline void c11log::details::pattern_formatter::compile_pattern(const std::string& pattern) { auto end = pattern.end(); for (auto it = pattern.begin(); it != end; ++it) @@ -209,7 +209,7 @@ inline void c11log::pattern_formatter::compile_pattern(const std::string& patter } } -inline void c11log::pattern_formatter::handle_flag(char flag) +inline void c11log::details::pattern_formatter::handle_flag(char flag) { switch (flag) { @@ -271,7 +271,7 @@ inline void c11log::pattern_formatter::handle_flag(char flag) } -inline void c11log::pattern_formatter::format(details::log_msg& msg) +inline void c11log::details::pattern_formatter::format(details::log_msg& msg) { details::fast_oss oss; for (auto &appender : _appenders) diff --git a/include/c11log/logger.h b/include/c11log/logger.h index b9bada9a..0059fd67 100644 --- a/include/c11log/logger.h +++ b/include/c11log/logger.h @@ -27,7 +27,7 @@ class line_logger; class logger { public: - using sink_ptr = std::shared_ptr; + using sink_ptr = std::shared_ptr; using sinks_vector_t = std::vector; using sinks_init_list = std::initializer_list; using formatter_ptr = std::unique_ptr;