Appender.hh
Go to the documentation of this file.
00001 /*
00002  * Appender.hh
00003  *
00004  * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
00005  * Copyright 2000, Bastiaan Bakker. All rights reserved.
00006  *
00007  * See the COPYING file for the terms of usage and distribution.
00008  */
00009 
00010 #ifndef _LOG4CPP_APPENDER_HH
00011 #define _LOG4CPP_APPENDER_HH
00012 
00013 #include <log4cpp/Portability.hh>
00014 #include <string>
00015 #include <map>
00016 #include <set>
00017 #include <stdarg.h>
00018 #include <sys/types.h>
00019 #include <sys/stat.h>
00020 #include <fcntl.h>
00021 #include <log4cpp/Priority.hh>
00022 #include <log4cpp/Layout.hh>
00023 #include <log4cpp/LoggingEvent.hh>
00024 #include <log4cpp/threading/Threading.hh>
00025 
00026 namespace log4cpp {
00027     class LOG4CPP_EXPORT Filter;
00028     
00033     class LOG4CPP_EXPORT Appender {
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 threading::Mutex _appenderMapMutex;
00138 
00139         static AppenderMap& _getAllAppenders();
00140         static void _deleteAllAppenders();
00141         static void _addAppender(Appender* appender);
00142         static void _removeAppender(Appender* appender);
00143 
00144         const std::string _name;
00145     };
00146 
00147     typedef std::set<Appender *> AppenderSet;
00148 }
00149 
00150 #endif // _LOG4CPP_APPENDER_HH


log4cpp
Author(s): Stephen Roderick
autogenerated on Mon Oct 6 2014 03:13:14