MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventLogger.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef EVENTLOGGER_H
19 #define EVENTLOGGER_H
20 
21 #include <logger/Logger.hpp>
22 #include <kernel/kernel_types.h>
23 #include <kernel/LogLevel.hpp>
24 #include <kernel/signaldata/EventReport.hpp>
25 
27 public:
28  virtual ~EventLoggerBase();
29 
34 
41  typedef void (* EventTextFunction)(char *,size_t,const Uint32*, Uint32 len);
42 
44  Ndb_logevent_type eventType;
45  LogLevel::EventCategory eventCategory;
46  Uint32 threshold;
47  Logger::LoggerLevel severity;
48  EventTextFunction textF;
49  };
50 
51  static const EventRepLogLevelMatrix matrix[];
52  static const Uint32 matrixSize;
53  static int event_lookup(int eventType,
54  LogLevel::EventCategory &cat,
55  Uint32 &threshold,
56  Logger::LoggerLevel &severity,
57  EventTextFunction &textF);
58 };
59 
94 class EventLogger : public EventLoggerBase, public Logger
95 {
96 public:
101  EventLogger();
102 
106  virtual ~EventLogger();
107 
111  void close();
112 
120  virtual void log(int, const Uint32*, Uint32 len, NodeId = 0,const class LogLevel * = 0);
121 
122 
131  static const char* getText(char * dst, size_t dst_len,
132  EventTextFunction textF,
133  const Uint32* theData, Uint32 len,
134  NodeId nodeId = 0);
135 
136 private:
138  EventLogger(const EventLogger&);
139  EventLogger operator = (const EventLogger&);
140  bool operator == (const EventLogger&);
141 
142  STATIC_CONST(MAX_TEXT_LENGTH = 256);
143 };
144 
145 extern void getRestartAction(Uint32 action, BaseString &str);
146 #endif