00001 /*---------------------------------------------------------------------------- 00002 Name: LogManager.h 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 -----------------------------------------------------------------------------*/ 00006 00007 #ifndef _ORG_XMLBLASTER_UTIL_LOGMANAGER_H 00008 #define _ORG_XMLBLASTER_UTIL_LOGMANAGER_H 00009 00010 #include <util/xmlBlasterDef.h> 00011 #include <string> 00012 #include <map> 00013 #include <util/I_LogFactory.h> 00014 #include <util/I_Log.h> 00015 00016 namespace org { namespace xmlBlaster { namespace util { 00017 00018 class DefaultLogFactory; // forward declaration 00019 00020 00031 class Dll_Export LogManager { 00032 00033 public: 00034 typedef org::xmlBlaster::util::I_LogFactory::PropMap PropMap; 00035 typedef std::map<std::string, org::xmlBlaster::util::I_LogFactory *> LogFactoryMap; 00036 00037 private: 00038 I_LogFactory *logFactory_; 00039 00043 LogManager(const LogManager& rhs); 00044 00048 LogManager& operator=(const LogManager& rhs); 00049 00050 public: 00051 LogManager(); 00052 00053 virtual ~LogManager(); 00054 00058 void initialize(const PropMap& propMap); 00059 00064 I_LogFactory& getLogFactory(const std::string& name="DEFAULT") const; 00065 00074 void setLogFactory(const std::string& name, I_LogFactory* logFactory); 00075 00076 }; // end of class LogManager 00077 00078 00079 00084 class Dll_Export DefaultLogFactory : public I_LogFactory { 00085 public: 00086 typedef std::map<std::string, org::xmlBlaster::util::I_Log *> LogMap; 00087 private: 00088 LogMap logMap_; 00089 public: 00090 //void initialize(const PropMap& propMap); 00091 //DefaultLogFactory(){}; 00092 virtual ~DefaultLogFactory(); 00093 I_Log& getLog(const std::string& name=""); 00094 void releaseLog(const std::string& name=""); 00095 }; // end of class DefaultLogFactory 00096 00097 00098 }}} // end of namespace util 00099 00100 #endif // _ORG_XMLBLASTER_UTIL_LOGMANAGER_H