1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Mark Atwood
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <drizzled/plugin.h>
24
#include <drizzled/plugin/logging.h>
25
#include <drizzled/plugin/error_message.h>
26
#include <drizzled/plugin/function.h>
32
using namespace drizzled;
34
namespace syslog_module
38
char* sysvar_facility;
39
bool sysvar_logging_enable;
40
char* sysvar_logging_priority;
41
unsigned long sysvar_logging_threshold_slow;
42
unsigned long sysvar_logging_threshold_big_resultset;
43
unsigned long sysvar_logging_threshold_big_examined;
44
bool sysvar_errmsg_enable;
45
char* sysvar_errmsg_priority;
47
static int init(drizzled::module::Context &context)
49
context.add(new Logging_syslog());
50
context.add(new ErrorMessage_syslog());
51
context.add(new plugin::Create_function<Function_syslog>("syslog"));
55
static DRIZZLE_SYSVAR_STR(
60
NULL, /* check func */
61
NULL, /* update func*/
62
"drizzled" /* default */);
64
static DRIZZLE_SYSVAR_STR(
68
N_("Syslog Facility"),
69
NULL, /* check func */
70
NULL, /* update func*/
71
"local0" /* default */); // local0 is what PostGreSQL uses by default
73
static DRIZZLE_SYSVAR_BOOL(
75
sysvar_logging_enable,
77
N_("Enable logging to syslog of the query log"),
78
NULL, /* check func */
79
NULL, /* update func */
82
static DRIZZLE_SYSVAR_STR(
84
sysvar_logging_priority,
86
N_("Syslog Priority of query logging"),
87
NULL, /* check func */
88
NULL, /* update func*/
89
"info" /* default */);
91
static DRIZZLE_SYSVAR_ULONG(
92
logging_threshold_slow,
93
sysvar_logging_threshold_slow,
95
N_("Threshold for logging slow queries, in microseconds"),
96
NULL, /* check func */
97
NULL, /* update func */
103
static DRIZZLE_SYSVAR_ULONG(
104
logging_threshold_big_resultset,
105
sysvar_logging_threshold_big_resultset,
107
N_("Threshold for logging big queries, for rows returned"),
108
NULL, /* check func */
109
NULL, /* update func */
115
static DRIZZLE_SYSVAR_ULONG(
116
logging_threshold_big_examined,
117
sysvar_logging_threshold_big_examined,
119
N_("Threshold for logging big queries, for rows examined"),
120
NULL, /* check func */
121
NULL, /* update func */
127
static DRIZZLE_SYSVAR_BOOL(
129
sysvar_errmsg_enable,
131
N_("Enable logging to syslog of the error messages"),
132
NULL, /* check func */
133
NULL, /* update func */
134
false /* default */);
136
static DRIZZLE_SYSVAR_STR(
138
sysvar_errmsg_priority,
140
N_("Syslog Priority of error messages"),
141
NULL, /* check func */
142
NULL, /* update func*/
143
"warning" /* default */);
145
static drizzle_sys_var* system_variables[]= {
146
DRIZZLE_SYSVAR(ident),
147
DRIZZLE_SYSVAR(facility),
148
DRIZZLE_SYSVAR(logging_enable),
149
DRIZZLE_SYSVAR(logging_priority),
150
DRIZZLE_SYSVAR(logging_threshold_slow),
151
DRIZZLE_SYSVAR(logging_threshold_big_resultset),
152
DRIZZLE_SYSVAR(logging_threshold_big_examined),
153
DRIZZLE_SYSVAR(errmsg_enable),
154
DRIZZLE_SYSVAR(errmsg_priority),
158
} // namespace syslog_module
160
DRIZZLE_PLUGIN(syslog_module::init, syslog_module::system_variables);