1 /* Copyright (c) 2003-2005 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef SYSLOGHANDLER_H
17 #define SYSLOGHANDLER_H
19 #include "LogHandler.hpp"
25 * Logs messages to syslog. The default identity is 'NDB'.
28 * It logs the following severity levels.
31 * LOG_ALERT A condition that should be corrected
32 * immediately, such as a corrupted system
35 * LOG_CRIT Critical conditions, such as hard device
40 * LOG_WARNING Warning messages.
42 * LOG_INFO Informational messages.
44 * LOG_DEBUG Messages that contain information nor-
45 * mally of use only when debugging a pro-
50 * @version #@ $Id: SysLogHandler.hpp,v 1.2 2003/09/01 10:15:53 innpeno Exp $
52 class SysLogHandler
: public LogHandler
56 * Default constructor.
61 * Create a new syslog handler with the specified identity.
63 * @param pIdentity a syslog identity.
64 * @param facility syslog facility, defaults to LOG_USER
66 SysLogHandler(const char* pIdentity
, int facility
);
71 virtual ~SysLogHandler();
76 virtual bool setParam(const BaseString
¶m
, const BaseString
&value
);
77 bool setFacility(const BaseString
&facility
);
80 virtual void writeHeader(const char* pCategory
, Logger::LoggerLevel level
);
81 virtual void writeMessage(const char* pMsg
);
82 virtual void writeFooter();
86 SysLogHandler(const SysLogHandler
&);
87 SysLogHandler
operator = (const SysLogHandler
&);
88 bool operator == (const SysLogHandler
&);
91 const char* m_pCategory
;
93 /** Syslog identity for all log entries. */
94 const char* m_pIdentity
;