27
27
#include "errmsg.h"
30
using namespace drizzled;
32
ErrorMessage_syslog::ErrorMessage_syslog()
33
: drizzled::plugin::ErrorMessage("ErrorMessage_syslog")
35
syslog_facility= WrapSyslog::getFacilityByName(syslog_module::sysvar_facility);
36
if (syslog_facility == -1)
38
errmsg_printf(ERRMSG_LVL_WARN,
39
_("syslog facility \"%s\" not known, using \"local0\""),
40
syslog_module::sysvar_facility);
41
syslog_facility= WrapSyslog::getFacilityByName("local0");
42
assert (! (syslog_facility == -1));
45
syslog_priority= WrapSyslog::getPriorityByName(syslog_module::sysvar_errmsg_priority);
46
if (syslog_priority == -1)
48
errmsg_printf(ERRMSG_LVL_WARN,
49
_("syslog priority \"%s\" not known, using \"warn\""),
50
syslog_module::sysvar_errmsg_priority);
51
syslog_priority= WrapSyslog::getPriorityByName("warn");
52
assert (! (syslog_priority == -1));
55
WrapSyslog::singleton().openlog(syslog_module::sysvar_ident);
30
namespace drizzle_plugin
33
error_message::Syslog::Syslog(const std::string& facility,
34
const std::string& priority) :
35
drizzled::plugin::ErrorMessage("Syslog"),
36
_facility(WrapSyslog::getFacilityByName(facility.c_str())),
37
_priority(WrapSyslog::getPriorityByName(priority.c_str()))
41
drizzled::errmsg_printf(ERRMSG_LVL_WARN,
42
_("syslog facility \"%s\" not known, using \"local0\""),
44
_facility= WrapSyslog::getFacilityByName("local0");
49
drizzled::errmsg_printf(ERRMSG_LVL_WARN,
50
_("syslog priority \"%s\" not known, using \"warn\""),
52
_priority= WrapSyslog::getPriorityByName("warn");
58
bool ErrorMessage_syslog::errmsg(drizzled::Session *,
60
const char *format, va_list ap)
56
bool error_message::Syslog::errmsg(drizzled::Session *,
57
int, const char *format, va_list ap)
62
if (syslog_module::sysvar_errmsg_enable == false)
64
WrapSyslog::singleton().vlog(syslog_facility, syslog_priority, format, ap);
59
WrapSyslog::singleton().vlog(_facility, _priority, format, ap);
63
} /* namespace drizzle_plugin */