00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <drizzled/gettext.h>
00023 #include <drizzled/errmsg_print.h>
00024
00025 #include <cstdarg>
00026
00027 #include <plugin/syslog/errmsg.h>
00028 #include <plugin/syslog/wrap.h>
00029
00030 namespace drizzle_plugin
00031 {
00032
00033 error_message::Syslog::Syslog(const std::string& facility) :
00034 drizzled::plugin::ErrorMessage("Syslog"),
00035 _facility(WrapSyslog::getFacilityByName(facility.c_str()))
00036 {
00037 if (_facility == -1)
00038 {
00039 drizzled::errmsg_printf(drizzled::error::WARN,
00040 _("syslog facility \"%s\" not known, using \"local0\""),
00041 facility.c_str());
00042 _facility= WrapSyslog::getFacilityByName("local0");
00043 }
00044 }
00045
00046 bool error_message::Syslog::errmsg(drizzled::error::priority_t priority, const char *format, va_list ap)
00047 {
00048 WrapSyslog::singleton().vlog(_facility, priority, format, ap);
00049 return false;
00050 }
00051
00052 }