From e27b45e3f048a190e205bf9c2eb8b9e2843bbaeb Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 22 Feb 2014 01:16:59 +0200 Subject: [PATCH] removed uneeded files --- example/example.cpp | 10 ++--- include/c11log/details/blocking_queue.h | 4 +- include/c11log/details/message.h | 31 -------------- include/c11log/details/null_mutex.h | 15 ------- .../{formatters/formatters.h => formatter.h} | 4 +- include/c11log/log_exception.h | 41 ------------------- include/c11log/sinks/base_sink.h | 2 +- 7 files changed, 9 insertions(+), 98 deletions(-) delete mode 100644 include/c11log/details/message.h delete mode 100644 include/c11log/details/null_mutex.h rename include/c11log/{formatters/formatters.h => formatter.h} (94%) delete mode 100644 include/c11log/log_exception.h diff --git a/example/example.cpp b/example/example.cpp index badb9265..75d3750f 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -56,11 +56,11 @@ int main(int argc, char* argv[]) int qsize = atoi(argv[1]); int threads = atoi(argv[2]); - using namespace c11log::sinks; - auto null_sink = std::make_shared(); - auto stdout_sink = std::make_shared(); - auto async = std::make_shared(qsize); - auto fsink = std::make_shared("example_log", "txt", 1024*1024*50 , 5); + using namespace c11log; + auto null_sink = std::make_shared(); + auto stdout_sink = std::make_shared(); + auto async = std::make_shared(qsize); + auto fsink = std::make_shared("example_log", "txt", 1024*1024*50 , 5); async->add_sink(fsink); diff --git a/include/c11log/details/blocking_queue.h b/include/c11log/details/blocking_queue.h index bc154e41..d38512d8 100644 --- a/include/c11log/details/blocking_queue.h +++ b/include/c11log/details/blocking_queue.h @@ -103,9 +103,7 @@ private: std::mutex mutex_; std::condition_variable item_pushed_cond_; std::condition_variable item_popped_cond_; - const std::chrono::hours one_hour { - 1 - }; + const std::chrono::hours one_hour (1); }; } diff --git a/include/c11log/details/message.h b/include/c11log/details/message.h deleted file mode 100644 index 5e68f0af..00000000 --- a/include/c11log/details/message.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include -#include "../level.h" - -namespace c11log { -namespace details { -struct message { - message(const std::string& logger_name, - level::level_enum log_level, - const std::chrono::system_clock::time_point time_p - , const std::string& msg) : - logger_name(logger_name), - log_level(log_level), - time_p(time_p), - msg(msg) {} - - ~message() = default; - message(const message& other) = default; - message& operator=(const message& rhs) = default; - - - std::string logger_name; - level::level_enum log_level; - std::chrono::system_clock::time_point time_p; - std::string msg; -}; - -} -} diff --git a/include/c11log/details/null_mutex.h b/include/c11log/details/null_mutex.h deleted file mode 100644 index bc82fecb..00000000 --- a/include/c11log/details/null_mutex.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -namespace c11log { -namespace details { -struct null_mutex { - void lock() { - } - void unlock() { - } - bool try_lock() { - return true; - } -}; -} -} \ No newline at end of file diff --git a/include/c11log/formatters/formatters.h b/include/c11log/formatter.h similarity index 94% rename from include/c11log/formatters/formatters.h rename to include/c11log/formatter.h index d4f15cf9..af8324b0 100644 --- a/include/c11log/formatters/formatters.h +++ b/include/c11log/formatter.h @@ -5,8 +5,8 @@ #include #include -#include "../level.h" -#include "../details/os.h" +#include "level.h" +#include "details/os.h" namespace c11log { namespace formatters { diff --git a/include/c11log/log_exception.h b/include/c11log/log_exception.h deleted file mode 100644 index 7c81e295..00000000 --- a/include/c11log/log_exception.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#include -#include - -namespace c11log { -class log_exception :public std::exception { -public: - log_exception() : _oss(), _msg() { - } - - virtual ~log_exception() { - } - - explicit log_exception(const std::string& msg) :_oss(msg, std::ostringstream::ate), _msg(msg) { - } - - log_exception(const log_exception &other) :_oss(other._oss.str()), _msg(other._msg) { - } - - log_exception& operator=(const log_exception& other) { - _oss.str(other._oss.str()); - _msg = other._msg; - return *this; - } - - virtual const char* what() const throw () override { - return _msg.c_str(); - } - - template - log_exception& operator<<(const T& what) { - _oss << what; - _msg = _oss.str(); - return *this; - } - -private: - std::ostringstream _oss; - std::string _msg; -}; -} \ No newline at end of file diff --git a/include/c11log/sinks/base_sink.h b/include/c11log/sinks/base_sink.h index 7e4a28cb..e3e61fbf 100644 --- a/include/c11log/sinks/base_sink.h +++ b/include/c11log/sinks/base_sink.h @@ -3,7 +3,7 @@ #include #include -#include "../formatters/formatters.h" +#include "../formatter.h" #include "../level.h" namespace c11log {