00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023 #ifndef _LOG4CPLUS_HIERARCHY_HEADER_
00024 #define _LOG4CPLUS_HIERARCHY_HEADER_
00025
00026 #include "dcmtk/oflog/config.h"
00027 #include "dcmtk/oflog/logger.h"
00028 #include "dcmtk/oflog/helpers/lloguser.h"
00029 #include "dcmtk/oflog/helpers/pointer.h"
00030 #include "dcmtk/oflog/helpers/threads.h"
00031
00032
00033
00034
00035
00036 namespace log4cplus {
00037
00038 class HierarchyLocker;
00039
00059 class LOG4CPLUS_EXPORT Hierarchy : protected log4cplus::helpers::LogLogUser {
00060 public:
00061
00062
00063 static const LogLevel DISABLE_OFF;
00064 static const LogLevel DISABLE_OVERRIDE;
00065
00066
00070 Hierarchy();
00071
00072
00073 virtual ~Hierarchy();
00074
00075
00084 virtual void clear();
00085
00092 virtual bool exists(const log4cplus::tstring& name);
00093
00098 virtual void disable(const log4cplus::tstring& loglevelStr);
00099
00119 virtual void disable(LogLevel ll);
00120
00126 virtual void disableAll();
00127
00133 virtual void disableDebug();
00134
00140 virtual void disableInfo();
00141
00149 virtual void enableAll();
00150
00161 virtual Logger getInstance(const log4cplus::tstring& name);
00162
00175 virtual Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
00176
00182 virtual LoggerList getCurrentLoggers();
00183
00187 virtual bool isDisabled(int level);
00188
00192 virtual Logger getRoot() const;
00193
00207 virtual void resetConfiguration();
00208
00212 virtual void setLoggerFactory(OFauto_ptr<spi::LoggerFactory> factory);
00213
00217 virtual spi::LoggerFactory* getLoggerFactory() { return defaultFactory.get(); }
00218
00232 virtual void shutdown();
00233
00234 private:
00235
00236 typedef OFList<Logger> ProvisionNode;
00237 typedef OFListIterator(Logger) ProvisionNodeIterator;
00238 typedef OFMap<log4cplus::tstring, ProvisionNode> ProvisionNodeMap;
00239 typedef OFMap<log4cplus::tstring, Logger> LoggerMap;
00240
00241
00246 virtual Logger getInstanceImpl(const log4cplus::tstring& name,
00247 spi::LoggerFactory& factory);
00248
00253 virtual void initializeLoggerList(LoggerList& list) const;
00254
00275 void updateParents(Logger logger);
00276
00291 void updateChildren(ProvisionNode& pn, Logger logger);
00292
00293
00294 LOG4CPLUS_MUTEX_PTR_DECLARE hashtable_mutex;
00295 OFauto_ptr<spi::LoggerFactory> defaultFactory;
00296 ProvisionNodeMap provisionNodes;
00297 LoggerMap loggerPtrs;
00298 Logger root;
00299
00300 int disableValue;
00301
00302 bool emittedNoAppenderWarning;
00303 bool emittedNoResourceBundleWarning;
00304
00305
00306 Hierarchy(const Hierarchy&);
00307 Hierarchy& operator=(const Hierarchy&);
00308
00309
00310 friend class log4cplus::spi::LoggerImpl;
00311 friend class log4cplus::HierarchyLocker;
00312 };
00313
00314 }
00315
00316 #endif // _LOG4CPLUS_HIERARCHY_HEADER_
00317