소스 검색

Removing 'i' prefix

Samuel Jaffe 9 년 전
부모
커밋
b8a205ba8b
3개의 변경된 파일36개의 추가작업 그리고 36개의 파일을 삭제
  1. 14 14
      logger.cpp
  2. 20 20
      logger.hpp
  3. 2 2
      logger_fwd.hpp

+ 14 - 14
logger.cpp

@@ -22,7 +22,7 @@ namespace logging {
 case logging::L##l: \
 return #l;
   
-  const char* level_header(ilog_level l) {
+  const char* level_header(log_level l) {
     assert(l != logging::LNONE);
     switch (l) {
         X(FATAL)
@@ -63,7 +63,7 @@ namespace logging {
     return true;
   }
   
-  ilogger_impl& _i_get_shared_instance() {
+  logger_impl& _i_get_shared_instance() {
     if (_impl_binding == nullptr) {
       return _default_logger_impl();
     } else {
@@ -73,56 +73,56 @@ namespace logging {
 }
 
 namespace logging {
-  ilogger& ilogger::instance() {
-    static ilogger instance;
+  logger& logger::instance() {
+    static logger instance;
     return instance;
   }
   
-  ilogger& ilogger::instance(std::string const & name) {
-    using p_logger = std::unique_ptr<ilogger>;
+  logger& logger::instance(std::string const & name) {
+    using p_logger = std::unique_ptr<logger>;
     using store = std::map<std::string, p_logger>;
     static store instances;
     store::iterator it;
     if ((it = instances.find(name)) != instances.end()) {
       return *(it->second);
     }
-    return *(instances.emplace(std::make_pair(name, p_logger(new ilogger(name)))).first->second);
+    return *(instances.emplace(std::make_pair(name, p_logger(new logger(name)))).first->second);
   }
   
   
-  ilogger::ilogger(std::string const & name)
+  logger::logger(std::string const & name)
   : min_level_(LDEBUG)
   , logger_name_(name)
   , impl_(_i_get_shared_instance())
   {
   }
   
-  ilogger::~ilogger() {
+  logger::~logger() {
     flush();
   }
   
-  void ilogger::log(ilog_level ll, location_info info, std::string const & msg) {
+  void logger::log(log_level ll, location_info info, std::string const & msg) {
     impl_.write({ now( ), ll, info, logger_name_.c_str(), msg });
   }
   
-  bool ilogger::should_log( ilog_level ll ) const {
+  bool logger::should_log( log_level ll ) const {
     return ll < min_level_ && impl_.should_log( ll );
   }
   
-  void ilogger::flush() {
+  void logger::flush() {
     impl_.flush();
   }
 }
 
 namespace logging {
   
-  bool ilogger_impl::should_log( ilog_level ll ) const {
+  bool logger_impl::should_log( log_level ll ) const {
     return ll < min_log_level;
   }
 }
 
 void test() {
-  logging::ilogger & LOG = logging::ilogger::instance( );
+  logging::logger & LOG = logging::logger::instance( );
   LOG.log(logging::LERROR, "{}", 5);
 }
 

+ 20 - 20
logger.hpp

@@ -29,25 +29,25 @@
 #define log_message( logger, level, ... ) logger.log( level, { __FILE__, __LINE__, STRING( FUNCTION ) }, __VA_ARGS__ )
 
 namespace logging {
-  class ilogger_impl;
-  typedef ilogger_impl& (*_binding)(void);
+  class logger_impl;
+  typedef logger_impl& (*_binding)(void);
   bool bind_logger_impl(_binding impl);
     
-  const char* level_header(ilog_level);
+  const char* level_header(log_level);
   
-  class ilogger {
+  class logger {
   public:
-    static ilogger& instance();
-    static ilogger& instance(std::string const & key);
+    static logger& instance();
+    static logger& instance(std::string const & key);
   public:
     template <typename... Args>
-    inline void log(ilog_level ll,
+    inline void log(log_level ll,
                     std::string const & interp, Args && ...args) {
       log( ll, location_info{}, interp, std::forward<Args>(args)... );
     }
     
     template <typename... Args>
-    inline void log(ilog_level ll, location_info info,
+    inline void log(log_level ll, location_info info,
                     std::string const & interp, Args && ...args) {
       if ( should_log( ll ) ) {
         log( ll, info, format_msg( interp, std::forward<Args>(args)... ) );
@@ -56,27 +56,27 @@ namespace logging {
     
     void flush();
     
-    ~ilogger();
+    ~logger();
   private:
-    bool should_log( ilog_level ) const;
-    void log( ilog_level ll, location_info info, std::string const& );
+    bool should_log( log_level ) const;
+    void log( log_level ll, location_info info, std::string const& );
     
-    explicit ilogger(std::string const & name = "");
-    ilogger(ilogger const&);
-    ilogger& operator=(ilogger const&);
+    explicit logger(std::string const & name = "");
+    logger(logger const&);
+    logger& operator=(logger const&);
     
-    ilog_level min_level_;
+    log_level min_level_;
     std::string const logger_name_;
-    ilogger_impl& impl_;
+    logger_impl& impl_;
   };
   
-  class ilogger_impl {
+  class logger_impl {
   public:
-    bool should_log( ilog_level ll ) const;
+    bool should_log( log_level ll ) const;
     virtual void write( logpacket const & pkt ) = 0;
     virtual void flush() = 0;
-    virtual ~ilogger_impl() = default;
+    virtual ~logger_impl() = default;
   private:
-    ilog_level min_log_level;
+    log_level min_log_level;
   };
 }

+ 2 - 2
logger_fwd.hpp

@@ -8,7 +8,7 @@
 #pragma once
 
 namespace logging {
-  enum ilog_level {
+  enum log_level {
     LTRACE,
     LDEBUG,
     LINFO,
@@ -28,7 +28,7 @@ namespace logging {
   struct logpacket {
     struct timeval time;
     //    int thread_id;
-    ilog_level level;
+    log_level level;
     location_info info;
     const char* logger;
     std::string message;