00001 /* 00002 * SyslogAppender.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_SYSLOGAPPENDER_HH 00011 #define _LOG4CPP_SYSLOGAPPENDER_HH 00012 00013 #include <log4cpp/Portability.hh> 00014 #include <string> 00015 #include <stdarg.h> 00016 #include <syslog.h> 00017 #include <log4cpp/LayoutAppender.hh> 00018 #include <log4cpp/Priority.hh> 00019 00020 LOG4CPP_NS_BEGIN 00021 00025 class LOG4CPP_EXPORT SyslogAppender : public LayoutAppender { 00026 public: 00027 00033 static int toSyslogPriority(Priority::Value priority); 00034 00044 SyslogAppender(const std::string& name, const std::string& syslogName, 00045 int facility = LOG_USER); 00046 virtual ~SyslogAppender(); 00047 00051 virtual bool reopen(); 00052 00056 virtual void close(); 00057 00058 protected: 00059 00063 virtual void open(); 00064 00069 virtual void _append(const LoggingEvent& event); 00070 00071 const std::string _syslogName; 00072 int _facility; 00073 }; 00074 LOG4CPP_NS_END 00075 00076 #endif // _LOG4CPP_SYSLOGAPPENDER_HH