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 LOG4CPP_NS_BEGIN
00027 class LOG4CPP_EXPORT Filter;
00028 
00033 class LOG4CPP_EXPORT Appender {
00034 public:
00035 
00036     // helps cleaning up
00037     friend class HierarchyMaintainer;
00038 
00045     static Appender* getAppender(const std::string& name);
00046 
00051     static bool reopenAll();
00052 
00057     static void closeAll();
00058 
00059 protected:
00065     Appender(const std::string& name);
00066 
00067 public:
00071     virtual ~Appender();
00072 
00077     virtual void doAppend(const LoggingEvent& event) = 0;
00078 
00084     virtual bool reopen() = 0;
00085 
00090     virtual void close() = 0;
00091 
00097     virtual bool requiresLayout() const = 0;
00098 
00103     virtual void setLayout(Layout* layout) = 0;
00104 
00109     inline const std::string& getName() const { return _name; };
00110 
00117     virtual void setThreshold(Priority::Value priority) = 0;
00118 
00123     virtual Priority::Value getThreshold() = 0;
00124 
00128     virtual void setFilter(Filter* filter) = 0;
00129 
00134     virtual Filter* getFilter() = 0;
00135 
00136 private:
00137     typedef std::map<std::string, Appender*> AppenderMap;
00138 
00139     static AppenderMap* _allAppenders;
00140     static threading::Mutex _appenderMapMutex;
00141 
00142     static AppenderMap& _getAllAppenders();
00143     static void _deleteAllAppenders();
00144     static void _addAppender(Appender* appender);
00145     static void _removeAppender(Appender* appender);
00146 
00147     const std::string _name;
00148 private:
00149     // suppress assignment operator
00150     Appender & operator=(const Appender &);
00151 };
00152 
00153 typedef std::set<Appender *> AppenderSet;
00154 LOG4CPP_NS_END
00155 
00156 #endif // _LOG4CPP_APPENDER_HH


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:01