API Documentation
00001 // Module: Log4CPLUS 00002 // File: loggerimpl.h 00003 // Created: 6/2001 00004 // Author: Tad E. Smith 00005 // 00006 // 00007 // Copyright (C) Tad E. Smith All rights reserved. 00008 // 00009 // This software is published under the terms of the Apache Software 00010 // License version 1.1, a copy of which has been included with this 00011 // distribution in the LICENSE.APL file. 00012 // 00013 00016 #ifndef _LOG4CPLUS_SPI_LOGGER_HEADER_ 00017 #define _LOG4CPLUS_SPI_LOGGER_HEADER_ 00018 00019 #include <log4cplus/config.h> 00020 #include <log4cplus/logger.h> 00021 #include <log4cplus/tstring.h> 00022 #include <log4cplus/helpers/appenderattachableimpl.h> 00023 #include <log4cplus/helpers/pointer.h> 00024 #include <log4cplus/spi/loggerfactory.h> 00025 #include <memory> 00026 #include <vector> 00027 00028 00029 namespace log4cplus { 00030 namespace spi { 00031 00040 class LOG4CPLUS_EXPORT LoggerImpl : public log4cplus::helpers::SharedObject, 00041 public log4cplus::helpers::AppenderAttachableImpl 00042 { 00043 public: 00044 // Methods 00045 00057 virtual void callAppenders(const InternalLoggingEvent& event); 00058 00063 virtual void closeNestedAppenders(); 00064 00071 virtual bool isEnabledFor(LogLevel ll) const; 00072 00076 virtual void log(LogLevel ll, const log4cplus::tstring& message, 00077 const char* file=NULL, int line=-1); 00078 00087 virtual LogLevel getChainedLogLevel() const; 00088 00094 LogLevel getLogLevel() const { return this->ll; } 00095 00099 void setLogLevel(LogLevel _ll) { this->ll = _ll; } 00100 00105 virtual Hierarchy& getHierarchy() const; 00106 00110 log4cplus::tstring getName() const { return name; } 00111 00115 bool getAdditivity() const; 00116 00120 void setAdditivity(bool additive); 00121 00122 virtual ~LoggerImpl(); 00123 00124 protected: 00125 // Ctors 00135 LoggerImpl(const log4cplus::tstring& name, Hierarchy& h); 00136 00137 00138 // Methods 00143 virtual void forcedLog(LogLevel ll, 00144 const log4cplus::tstring& message, 00145 const char* file=NULL, 00146 int line=-1); 00147 00148 00149 // Data 00151 log4cplus::tstring name; 00152 00156 LogLevel ll; 00157 00162 SharedLoggerImplPtr parent; 00163 00173 bool additive; 00174 00175 private: 00176 // Data 00178 Hierarchy& hierarchy; 00179 00180 // Disallow copying of instances of this class 00181 LoggerImpl(const LoggerImpl&); 00182 LoggerImpl& operator=(const LoggerImpl&); 00183 00184 // Friends 00185 friend class log4cplus::Logger; 00186 friend class log4cplus::DefaultLoggerFactory; 00187 friend class log4cplus::Hierarchy; 00188 }; 00189 00190 } // end namespace spi 00191 } // end namespace log4cplus 00192 00193 #endif // _LOG4CPLUS_SPI_LOGGER_HEADER_ 00194 00195