log4shib 2.0.0

SyslogAppender.hh
Go to the documentation of this file.
1/*
2 * SyslogAppender.hh
3 *
4 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
5 * Copyright 2000, Bastiaan Bakker. All rights reserved.
6 *
7 * See the COPYING file for the terms of usage and distribution.
8 */
9
10#ifndef _LOG4SHIB_SYSLOGAPPENDER_HH
11#define _LOG4SHIB_SYSLOGAPPENDER_HH
12
13#include <log4shib/Portability.hh>
14#include <string>
15#include <stdarg.h>
16#include <syslog.h>
17#include <log4shib/LayoutAppender.hh>
18#include <log4shib/Priority.hh>
19
20 namespace log4shib {
21
25 class SyslogAppender : public LayoutAppender {
26 public:
27
33 static int toSyslogPriority(Priority::Value priority);
34
44 SyslogAppender(const std::string& name, const std::string& syslogName,
45 int facility = LOG_USER);
46 virtual ~SyslogAppender();
47
51 virtual bool reopen();
52
56 virtual void close();
57
58 protected:
59
63 virtual void open();
64
69 virtual void _append(const LoggingEvent& event);
70
71 const std::string _syslogName;
72 int _facility;
73 };
74}
75
76#endif // _LOG4SHIB_SYSLOGAPPENDER_HH
LayoutAppender.hh
Portability.hh
Priority.hh
LOG_USER
@ LOG_USER
random user-level messages
Definition: RemoteSyslogAppender.hh:41
log4shib::LayoutAppender
LayoutAppender is a common superclass for all Appenders that require a Layout.
Definition: LayoutAppender.hh:24
log4shib::Priority::Value
int Value
The type of Priority Values.
Definition: Priority.hh:84
log4shib::SyslogAppender
SyslogAppender sends LoggingEvents to the local syslog system.
Definition: SyslogAppender.hh:25
log4shib::SyslogAppender::~SyslogAppender
virtual ~SyslogAppender()
log4shib::SyslogAppender::SyslogAppender
SyslogAppender(const std::string &name, const std::string &syslogName, int facility=LOG_USER)
Instantiate a SyslogAppender with given name and name and facility for syslog.
log4shib::SyslogAppender::close
virtual void close()
Calls closelog(3) to close the syslog file descriptor.
log4shib::SyslogAppender::toSyslogPriority
static int toSyslogPriority(Priority::Value priority)
Translates a log4shib priority to a syslog priority.
log4shib::SyslogAppender::_append
virtual void _append(const LoggingEvent &event)
Sends a LoggingEvent to syslog.
log4shib::SyslogAppender::reopen
virtual bool reopen()
Calls closelog(3) and openlog(3).
log4shib::SyslogAppender::_facility
int _facility
Definition: SyslogAppender.hh:72
log4shib::SyslogAppender::_syslogName
const std::string _syslogName
Definition: SyslogAppender.hh:71
log4shib::SyslogAppender::open
virtual void open()
Calls openlog(3).
log4shib
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
log4shib::LoggingEvent
The internal representation of logging events.
Definition: LoggingEvent.hh:32