00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _LOG4CPP_APPENDER_HH
00011 #define _LOG4CPP_APPENDER_HH
00012
00013 #include <string>
00014 #include <map>
00015 #include <stdarg.h>
00016 #include "log4cpp/Export.hh"
00017 #include "log4cpp/OstringStream.hh"
00018 #include "log4cpp/Priority.hh"
00019 #include "log4cpp/Layout.hh"
00020 #include "log4cpp/LoggingEvent.hh"
00021 #include "log4cpp/Filter.hh"
00022 #include "log4cpp/Log4cppCleanup.hh"
00023
00024 namespace log4cpp {
00025 class LOG4CPP_EXPORT Category;
00026
00031 class LOG4CPP_EXPORT Appender {
00032 friend class log4cpp::Log4cppCleanup;
00033
00034 public:
00035
00042 static Appender* getAppender(const std::string& name);
00043
00048 static bool reopenAll();
00049
00054 static void closeAll();
00055
00056 protected:
00062 Appender(const std::string& name);
00063
00064 public:
00068 virtual ~Appender();
00069
00074 virtual void doAppend(const LoggingEvent& event) = 0;
00075
00081 virtual bool reopen() = 0;
00082
00087 virtual void close() = 0;
00088
00094 virtual bool requiresLayout() const = 0;
00095
00100 virtual void setLayout(Layout* layout) = 0;
00101
00106 inline const std::string& getName() const { return _name; };
00107
00114 virtual void setThreshold(Priority::Value priority) = 0;
00115
00120 virtual Priority::Value getThreshold() = 0;
00121
00125 virtual void setFilter(Filter* filter) = 0;
00126
00131 virtual Filter* getFilter() = 0;
00132
00133 private:
00134 typedef std::map<std::string, Appender*> AppenderMap;
00135
00136 static AppenderMap* _allAppenders;
00137 static AppenderMap& _getAllAppenders();
00138 static void _deleteAllAppenders();
00139 static void _addAppender(Appender* appender);
00140 static void _removeAppender(Appender* appender);
00141 static Log4cppCleanup& _fuckinDummy;
00142
00143 const std::string _name;
00144 };
00145 }
00146
00147 #endif // _LOG4CPP_APPENDER_HH