Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

RemoteSyslogAppender.hh

Go to the documentation of this file.
00001 /*
00002  * SyslogAppender.hh
00003  *
00004  * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
00005  * Copyright 2001, Walter Stroebel. All rights reserved.
00006  *
00007  * See the COPYING file for the terms of usage and distribution.
00008  */
00009 
00010 #ifndef _LOG4CPP_REMOTESYSLOGAPPENDER_HH
00011 #define _LOG4CPP_REMOTESYSLOGAPPENDER_HH
00012 
00013 #include <log4cpp/Portability.hh>
00014 #include <string>
00015 #include <stdarg.h>
00016 #include <log4cpp/LayoutAppender.hh>
00017 #include <log4cpp/Priority.hh>
00018 
00019 #ifdef LOG4CPP_HAVE_SYSLOG
00020 #include <syslog.h>
00021 #else
00022 
00023 typedef enum {
00024     LOG_EMERG   = 0,       
00025     LOG_ALERT   = 1,       
00026     LOG_CRIT    = 2,       
00027     LOG_ERR     = 3,       
00028     LOG_WARNING = 4,       
00029     LOG_NOTICE  = 5,       
00030     LOG_INFO    = 6,       
00031     LOG_DEBUG   = 7,       
00032 } SyslogLevel;
00033 
00034 typedef enum {
00035     LOG_KERN     = (0<<3),  
00036     LOG_USER     = (1<<3),  
00037     LOG_MAIL     = (2<<3),  
00038     LOG_DAEMON   = (3<<3),  
00039     LOG_AUTH     = (4<<3),  
00040     LOG_SYSLOG   = (5<<3),  
00041     LOG_LPR      = (6<<3),  
00042     LOG_NEWS     = (7<<3),  
00043     LOG_UUCP     = (8<<3),  
00044     LOG_CRON     = (9<<3),  
00045     LOG_AUTHPRIV = (10<<3), 
00046     LOG_FTP      = (11<<3), 
00047     
00048     /* other codes through 15 reserved for system use */ 
00049     LOG_LOCAL0   = (16<<3), 
00050     LOG_LOCAL1   = (17<<3), 
00051     LOG_LOCAL2   = (18<<3), 
00052     LOG_LOCAL3   = (19<<3), 
00053     LOG_LOCAL4   = (20<<3), 
00054     LOG_LOCAL5   = (21<<3), 
00055     LOG_LOCAL6   = (22<<3), 
00056     LOG_LOCAL7   = (23<<3), 
00057 } SyslogFacility;
00058 #endif
00059 
00060 namespace log4cpp {
00061 
00067     class LOG4CPP_EXPORT RemoteSyslogAppender : public LayoutAppender {
00068         public:
00069 
00075         static int toSyslogPriority(Priority::Value priority);
00076 
00089         RemoteSyslogAppender(const std::string& name, 
00090                              const std::string& syslogName, 
00091                              const std::string& relayer, 
00092                              int facility = LOG_USER,
00093                              int portNumber = 514);
00094         virtual ~RemoteSyslogAppender();
00095 
00099         virtual bool reopen();
00100 
00104         virtual void close();
00105 
00106         protected:
00107         
00111         virtual void open();
00112 
00117         virtual void _append(const LoggingEvent& event);
00118 
00119         const std::string _syslogName;
00120         const std::string _relayer;
00121         int _facility;
00122         int _portNumber;
00123         int _socket;
00124         unsigned long _ipAddr;
00125         private:
00126         int _cludge;
00127     };
00128 }
00129 
00130 #endif // _LOG4CPP_REMOTESYSLOGAPPENDER_HH

Generated on Mon Oct 28 23:41:43 2002 for log4cpp by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002