48
65
Logging_handler *p = static_cast<Logging_handler *>(plugin->data);
50
if (plugin->plugin->deinit)
52
if (plugin->plugin->deinit((void *)p))
71
if (plugin->plugin->deinit)
54
/* TRANSLATORS: The leading word "logging" is the name
55
of the plugin api, and so should not be translated. */
56
errmsg_printf(ERRMSG_LVL_ERROR, _("logging plugin '%s' deinit() failed"),
73
if (plugin->plugin->deinit((void *)p))
75
/* TRANSLATORS: The leading word "logging" is the name
76
of the plugin api, and so should not be translated. */
77
errmsg_printf(ERRMSG_LVL_ERROR, _("logging plugin '%s' deinit() failed"),
64
/* This gets called by plugin_foreach once for each loaded logging plugin */
65
static bool logging_pre_iterate (Session *session, plugin_ref plugin, void *)
86
class LoggingPreIterate : public unary_function<Logging_handler *, bool>
67
Logging_handler *handler= plugin_data(plugin, Logging_handler *);
90
LoggingPreIterate(Session *session_arg) :
91
unary_function<Logging_handler *, bool>(),
92
session(session_arg) {}
69
/* call this loaded logging plugin's logging_pre function pointer */
94
inline result_type operator()(argument_type handler)
72
96
if (handler->pre(session))
74
98
/* TRANSLATORS: The leading word "logging" is the name
75
99
of the plugin api, and so should not be translated. */
76
100
errmsg_printf(ERRMSG_LVL_ERROR,
77
_("logging plugin '%s' pre() failed"),
78
(char *)plugin_name(plugin));
101
_("logging '%s' pre() failed"),
102
handler->getName().c_str());
110
class LoggingPostIterate : public unary_function<Logging_handler *, bool>
114
LoggingPostIterate(Session *session_arg) :
115
unary_function<Logging_handler *, bool>(),
116
session(session_arg) {}
118
/* This gets called once for each loaded logging plugin */
119
inline result_type operator()(argument_type handler)
121
if (handler->post(session))
123
/* TRANSLATORS: The leading word "logging" is the name
124
of the plugin api, and so should not be translated. */
125
errmsg_printf(ERRMSG_LVL_ERROR,
126
_("logging '%s' post() failed"),
127
handler->getName().c_str());
85
135
/* This is the logging_pre_do entry point.
86
136
This gets called by the rest of the Drizzle server code */
87
137
bool logging_pre_do (Session *session)
91
foreach_rv= plugin_foreach(session, logging_pre_iterate, DRIZZLE_LOGGER_PLUGIN, NULL);
96
/* This gets called by plugin_foreach once for each loaded logging plugin */
97
static bool logging_post_iterate (Session *session, plugin_ref plugin, void *)
99
Logging_handler *handler= plugin_data(plugin, Logging_handler *);
103
if (handler->post(session))
105
/* TRANSLATORS: The leading word "logging" is the name
106
of the plugin api, and so should not be translated. */
107
errmsg_printf(ERRMSG_LVL_ERROR,
108
_("logging plugin '%s' post() failed"),
109
(char *)plugin_name(plugin));
116
/* This is the logging_pre_do entry point.
139
/* Use find_if instead of foreach so that we can collect return codes */
140
vector<Logging_handler *>::iterator iter=
141
find_if(all_loggers.begin(), all_loggers.end(),
142
LoggingPreIterate(session));
143
/* If iter is == end() here, that means that all of the plugins returned
144
* false, which in this case means they all succeeded. Since we want to
145
* return false on success, we return the value of the two being !=
147
return iter != all_loggers.end();
150
/* This is the logging_post_do entry point.
117
151
This gets called by the rest of the Drizzle server code */
118
152
bool logging_post_do (Session *session)
122
foreach_rv= plugin_foreach(session, logging_post_iterate, DRIZZLE_LOGGER_PLUGIN, NULL);
154
/* Use find_if instead of foreach so that we can collect return codes */
155
vector<Logging_handler *>::iterator iter=
156
find_if(all_loggers.begin(), all_loggers.end(),
157
LoggingPreIterate(session));
158
/* If iter is == end() here, that means that all of the plugins returned
159
* false, which in this case means they all succeeded. Since we want to
160
* return false on success, we return the value of the two being !=
162
return iter != all_loggers.end();