~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/include/logger/SysLogHandler.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef SYSLOGHANDLER_H
 
17
#define SYSLOGHANDLER_H
 
18
 
 
19
#include "LogHandler.hpp"
 
20
#ifndef NDB_WIN32
 
21
#include <syslog.h>
 
22
#endif
 
23
 
 
24
/**
 
25
 * Logs messages to syslog. The default identity is 'NDB'. 
 
26
 * See 'man 3 syslog'. 
 
27
 *
 
28
 * It logs the following severity levels.
 
29
 * <pre>
 
30
 *
 
31
 *  LOG_ALERT           A condition  that  should  be  corrected
 
32
 *                      immediately,  such as a corrupted system
 
33
 *                      database.
 
34
 *
 
35
 *  LOG_CRIT            Critical conditions, such as hard device
 
36
 *                      errors.
 
37
 *
 
38
 *  LOG_ERR             Errors.
 
39
 *
 
40
 *  LOG_WARNING         Warning messages.
 
41
 *
 
42
 *  LOG_INFO            Informational messages.
 
43
 *
 
44
 *  LOG_DEBUG           Messages that contain  information  nor-
 
45
 *                      mally  of use only when debugging a pro-
 
46
 *                      gram.
 
47
 * </pre>
 
48
 *
 
49
 * @see LogHandler
 
50
 * @version #@ $Id: SysLogHandler.hpp,v 1.2 2003/09/01 10:15:53 innpeno Exp $
 
51
 */
 
52
class SysLogHandler : public LogHandler
 
53
{
 
54
public:
 
55
  /**
 
56
   * Default constructor.
 
57
   */
 
58
  SysLogHandler();
 
59
  
 
60
  /**
 
61
   * Create a new syslog handler with the specified identity.
 
62
   *
 
63
   * @param pIdentity a syslog identity.
 
64
   * @param facility syslog facility, defaults to LOG_USER
 
65
   */
 
66
  SysLogHandler(const char* pIdentity, int facility);
 
67
 
 
68
  /**
 
69
   * Destructor.
 
70
   */
 
71
  virtual ~SysLogHandler();
 
72
  
 
73
  virtual bool open();
 
74
  virtual bool close();
 
75
 
 
76
  virtual bool setParam(const BaseString &param, const BaseString &value);
 
77
  bool setFacility(const BaseString &facility);
 
78
 
 
79
protected:      
 
80
  virtual void writeHeader(const char* pCategory, Logger::LoggerLevel level);
 
81
  virtual void writeMessage(const char* pMsg);
 
82
  virtual void writeFooter();
 
83
 
 
84
private:
 
85
  /** Prohibit*/
 
86
  SysLogHandler(const SysLogHandler&);
 
87
  SysLogHandler operator = (const SysLogHandler&);
 
88
  bool operator == (const SysLogHandler&);
 
89
 
 
90
  int m_severity;
 
91
  const char* m_pCategory;
 
92
 
 
93
  /** Syslog identity for all log entries. */
 
94
  const char* m_pIdentity;
 
95
  int m_facility;
 
96
};
 
97
 
 
98
#endif