22#include <drizzled/error.h>
23#include <drizzled/gettext.h>
24#include <drizzled/plugin/error_message.h>
33std::vector<plugin::ErrorMessage *> all_errmsg_handler;
37 all_errmsg_handler.push_back(&handler);
41void plugin::ErrorMessage::removePlugin(plugin::ErrorMessage &)
43 all_errmsg_handler.clear();
49 error::priority_t priority;
54 Print(error::priority_t priority_arg,
55 const char *format_arg, va_list ap_arg) :
56 priority(priority_arg), format(format_arg)
61 ~Print() { va_end(ap); }
66 va_copy(handler_ap, ap);
67 if (handler->errmsg(priority, format, handler_ap))
75 _(
"errmsg plugin '%s' errmsg() failed"),
76 handler->getName().c_str());
87bool plugin::ErrorMessage::vprintf(error::priority_t priority,
char const *format, va_list ap)
89 if (priority > error::verbosity())
98 if (all_errmsg_handler.size() == 0)
105 vfprintf(stderr, format, ap);
112 std::vector<plugin::ErrorMessage *>::iterator iter=
113 std::find_if(all_errmsg_handler.begin(), all_errmsg_handler.end(),
114 Print(priority, format, ap));
120 return iter != all_errmsg_handler.end();
TODO: Rename this file - func.h is stupid.