~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/logging.h

MergedĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Definitions required for Logging plugin 
3
 
*/
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Definitions required for Query Logging plugin
 
5
 *
 
6
 *  Copyright (C) 2008 Sun Microsystems
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; version 2 of the License.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 */
4
21
 
5
22
#ifndef DRIZZLED_PLUGIN_LOGGING_H
6
23
#define DRIZZLED_PLUGIN_LOGGING_H
7
24
 
8
 
typedef struct logging_st
9
 
{
10
 
  bool (*logging_pre)(THD *thd);
11
 
  bool (*logging_post)(THD *thd);
12
 
} logging_t;
 
25
#include <string>
 
26
 
 
27
namespace drizzled
 
28
{
 
29
namespace plugin
 
30
{
 
31
 
 
32
class Logging
 
33
{
 
34
  std::string name;
 
35
public:
 
36
  Logging(std::string name_arg): name(name_arg)  {}
 
37
  virtual ~Logging() {}
 
38
 
 
39
  std::string getName() { return name; }
 
40
  /**
 
41
   * Make these no-op rather than pure-virtual so that it's easy for a plugin
 
42
   * to only implement one.
 
43
   */
 
44
  virtual bool pre(Session *) {return false;}
 
45
  virtual bool post(Session *) {return false;}
 
46
 
 
47
  static void add(Logging *handler);
 
48
  static void remove(Logging *handler);
 
49
  static bool pre_do(Session *session);
 
50
  static bool post_do(Session *session);
 
51
};
 
52
 
 
53
} /* namespace plugin */
 
54
} /* namespace drizzled */
13
55
 
14
56
#endif /* DRIZZLED_PLUGIN_LOGGING_H */