util/Log4cplus.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
00002 Name:      Log4cplus.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 -----------------------------------------------------------------------------*/
00006 
00007 #ifndef _ORG_XMLBLASTER_UTIL_LOG4CPLUS_H
00008 #define _ORG_XMLBLASTER_UTIL_LOG4CPLUS_H
00009 
00010 #if XMLBLASTER_COMPILE_LOG4CPLUS_PLUGIN==1
00011 
00012 #include <util/xmlBlasterDef.h>
00013 #include <string>
00014 #include <map>
00015 #include <util/I_LogFactory.h>
00016 #include <util/I_Log.h>
00017 #include <log4cplus/logger.h>
00018 
00019 namespace org { namespace xmlBlaster { namespace util {
00020    
00043 class Dll_Export Log4cplusFactory : public I_LogFactory
00044 {
00045    public:
00046       typedef std::map<std::string, org::xmlBlaster::util::I_Log *> LogMap;
00047    private:
00048      LogMap logMap_;
00049    public:
00050       Log4cplusFactory();
00051       virtual ~Log4cplusFactory();
00052       void initialize(const PropMap& propMap);
00053       I_Log& getLog(const std::string& name="");
00054       void releaseLog(const std::string& name="");
00055 }; // end of class Log4cplus
00056 
00057 
00098 class Dll_Export Log4cplusLog : public I_Log
00099 {
00100   private:
00101    std::string logName_;
00102    log4cplus::Logger logger_;
00103 
00104   public:
00105    Log4cplusLog(std::string logName);
00106    void info(const std::string &instance, const std::string &text);
00107    void warn(const std::string &instance, const std::string &text);
00108    void error(const std::string &instance, const std::string &text);
00109    void panic(const std::string &instance, const std::string &text);
00110    void trace(const std::string &instance, const std::string &text);
00111    void call(const std::string &instance, const std::string &text);
00112    std::string usage() const;
00113 };
00114 
00115 
00116 }}} // end of namespace util
00117 
00118 #endif // XMLBLASTER_COMPILE_LOG4CPLUS_PLUGIN
00119 
00120 #endif // _ORG_XMLBLASTER_UTIL_LOG4CPLUS_H