4
// $Id: //poco/1.2/Foundation/include/Poco/SyslogChannel.h#1 $
8
// Module: SyslogChannel
10
// Definition of the SyslogChannel class specific to UNIX.
12
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
15
// Permission is hereby granted, free of charge, to any person or organization
16
// obtaining a copy of the software and accompanying documentation covered by
17
// this license (the "Software") to use, reproduce, display, distribute,
18
// execute, and transmit the Software, and to prepare derivative works of the
19
// Software, and to permit third-parties to whom the Software is furnished to
20
// do so, all subject to the following:
22
// The copyright notices in the Software and this entire statement, including
23
// the above license grant, this restriction and the following disclaimer,
24
// must be included in all copies of the Software, in whole or in part, and
25
// all derivative works of the Software, unless such copies or derivative
26
// works are solely in the form of machine-executable object code generated by
27
// a source language processor.
29
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35
// DEALINGS IN THE SOFTWARE.
39
#ifndef Foundation_SyslogChannel_INCLUDED
40
#define Foundation_SyslogChannel_INCLUDED
43
#include "Poco/Foundation.h"
44
#include "Poco/Channel.h"
50
class Foundation_API SyslogChannel: public Channel
51
/// This Unix-only channel works with the Unix syslog service.
56
SYSLOG_PID = 0x01, /// log the pid with each message
57
SYSLOG_CONS = 0x02, /// log on the console if errors in sending
58
SYSLOG_NDELAY = 0x08, /// don't delay open
59
SYSLOG_PERROR = 0x20 /// log to stderr as well (not supported on all platforms)
64
SYSLOG_KERN = ( 0<<3), /// kernel messages
65
SYSLOG_USER = ( 1<<3), /// random user-level messages
66
SYSLOG_MAIL = ( 2<<3), /// mail system
67
SYSLOG_DAEMON = ( 3<<3), /// system daemons
68
SYSLOG_AUTH = ( 4<<3), /// security/authorization messages
69
SYSLOG_SYSLOG = ( 5<<3), /// messages generated internally by syslogd
70
SYSLOG_LPR = ( 6<<3), /// line printer subsystem
71
SYSLOG_NEWS = ( 7<<3), /// network news subsystem
72
SYSLOG_UUCP = ( 8<<3), /// UUCP subsystem
73
SYSLOG_CRON = ( 9<<3), /// clock daemon
74
SYSLOG_AUTHPRIV = (10<<3), /// security/authorization messages (private)
75
SYSLOG_FTP = (11<<3), /// ftp daemon
76
SYSLOG_LOCAL0 = (16<<3), /// reserved for local use
77
SYSLOG_LOCAL1 = (17<<3), /// reserved for local use
78
SYSLOG_LOCAL2 = (18<<3), /// reserved for local use
79
SYSLOG_LOCAL3 = (19<<3), /// reserved for local use
80
SYSLOG_LOCAL4 = (20<<3), /// reserved for local use
81
SYSLOG_LOCAL5 = (21<<3), /// reserved for local use
82
SYSLOG_LOCAL6 = (22<<3), /// reserved for local use
83
SYSLOG_LOCAL7 = (23<<3) /// reserved for local use
87
/// Creates a SyslogChannel.
89
SyslogChannel(const std::string& name, int options = SYSLOG_CONS, int facility = SYSLOG_USER);
90
/// Creates a SyslogChannel with the given name, options and facility.
93
/// Opens the SyslogChannel.
96
/// Closes the SyslogChannel.
98
void log(const Message& msg);
99
/// Sens the message's text to the syslog service.
101
void setProperty(const std::string& name, const std::string& value);
102
/// Sets the property with the given value.
104
/// The following properties are supported:
105
/// * name: The name used to identify the source of log messages.
106
/// * facility: The facility added to each log message. See the Facility enumeration for a list of supported values.
107
/// * options: The logging options. See the Option enumeration for a list of supported values.
109
std::string getProperty(const std::string& name) const;
110
/// Returns the value of the property with the given name.
112
static const std::string PROP_NAME;
113
static const std::string PROP_FACILITY;
114
static const std::string PROP_OPTIONS;
118
static int getPrio(const Message& msg);
131
#endif // Foundation_SyslogChannel_INCLUDED