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 <string> 00014 #include <stdarg.h> 00015 #include <syslog.h> 00016 #include "log4cpp/LayoutAppender.hh" 00017 #include "log4cpp/Priority.hh" 00018 00019 namespace log4cpp { 00020 00024 class SyslogAppender : public LayoutAppender { 00025 public: 00026 00032 static int toSyslogPriority(Priority::Value priority); 00033 00043 SyslogAppender(const std::string& name, const std::string& syslogName, 00044 int facility = LOG_USER); 00045 virtual ~SyslogAppender(); 00046 00050 virtual bool reopen(); 00051 00055 virtual void close(); 00056 00057 protected: 00058 00062 virtual void open(); 00063 00068 virtual void _append(const LoggingEvent& event); 00069 00070 const std::string _syslogName; 00071 int _facility; 00072 }; 00073 } 00074 00075 #endif // _LOG4CPP_SYSLOGAPPENDER_HH