1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 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
20
#include <drizzled/server_includes.h>
21
#include <drizzled/logging.h>
22
#include <drizzled/gettext.h>
24
int logging_initializer(st_plugin_int *plugin)
28
p= (logging_t *) malloc(sizeof(logging_t));
29
if (p == NULL) return 1;
30
memset(p, 0, sizeof(logging_t));
32
plugin->data= (void *)p;
34
if (plugin->plugin->init)
36
if (plugin->plugin->init((void *)p))
38
/* TRANSLATORS: The leading word "logging" is the name
39
of the plugin api, and so should not be translated. */
40
sql_print_error("logging plugin '%s' init() failed",
52
int logging_finalizer(st_plugin_int *plugin)
54
logging_t *p = (logging_t *) plugin->data;
56
if (plugin->plugin->deinit)
58
if (plugin->plugin->deinit((void *)p))
60
/* TRANSLATORS: The leading word "logging" is the name
61
of the plugin api, and so should not be translated. */
62
sql_print_error(_("logging plugin '%s' deinit() failed"),
72
/* This gets called by plugin_foreach once for each loaded logging plugin */
73
static bool logging_pre_iterate (Session *session, plugin_ref plugin,
74
void *p __attribute__ ((__unused__)))
76
logging_t *l= plugin_data(plugin, logging_t *);
78
/* call this loaded logging plugin's logging_pre function pointer */
79
if (l && l->logging_pre)
81
if (l->logging_pre(session))
83
/* TRANSLATORS: The leading word "logging" is the name
84
of the plugin api, and so should not be translated. */
85
sql_print_error(_("logging plugin '%s' logging_pre() failed"),
86
(char *)plugin_name(plugin));
93
/* This is the logging_pre_do entry point.
94
This gets called by the rest of the Drizzle server code */
95
bool logging_pre_do (Session *session)
99
foreach_rv= plugin_foreach(session,
101
DRIZZLE_LOGGER_PLUGIN,
106
/* This gets called by plugin_foreach once for each loaded logging plugin */
107
static bool logging_post_iterate (Session *session, plugin_ref plugin,
108
void *p __attribute__ ((__unused__)))
110
logging_t *l= plugin_data(plugin, logging_t *);
112
if (l && l->logging_post)
114
if (l->logging_post(session))
116
/* TRANSLATORS: The leading word "logging" is the name
117
of the plugin api, and so should not be translated. */
118
sql_print_error(_("logging plugin '%s' logging_post() failed"),
119
(char *)plugin_name(plugin));
126
/* This is the logging_pre_do entry point.
127
This gets called by the rest of the Drizzle server code */
128
bool logging_post_do (Session *session)
132
foreach_rv= plugin_foreach(session,
133
logging_post_iterate,
134
DRIZZLE_LOGGER_PLUGIN,