00001 #if !defined(h_ebd0ee89_622d_4af1_9a9d_d0e057debe86) 00002 #define h_ebd0ee89_622d_4af1_9a9d_d0e057debe86 00003 00004 #include <log4cpp/LayoutAppender.hh> 00005 #include <log4cpp/TriggeringEventEvaluator.hh> 00006 #include <list> 00007 #include <memory> 00008 00009 LOG4CPP_NS_BEGIN 00010 class LOG4CPP_EXPORT BufferingAppender : public LayoutAppender 00011 { 00012 public: 00013 BufferingAppender(const std::string name, unsigned long max_size, std::auto_ptr<Appender> sink, 00014 std::auto_ptr<TriggeringEventEvaluator> evaluator); 00015 00016 virtual void close() { sink_->close(); } 00017 00018 bool getLossy() const { return lossy_; } 00019 void setLossy(bool lossy) { lossy_ = lossy; } 00020 00021 protected: 00022 virtual void _append(const LoggingEvent& event); 00023 00024 private: 00025 typedef std::list<LoggingEvent> queue_t; 00026 00027 queue_t queue_; 00028 unsigned long max_size_; 00029 std::auto_ptr<Appender> sink_; 00030 std::auto_ptr<TriggeringEventEvaluator> evaluator_; 00031 bool lossy_; 00032 00033 void dump(); 00034 }; 00035 LOG4CPP_NS_END 00036 00037 #endif // h_ebd0ee89_622d_4af1_9a9d_d0e057debe86