20
20
#include "config.h"
22
22
#include <drizzled/gettext.h>
23
#include <drizzled/errmsg_print.h>
23
#include <drizzled/session.h>
25
25
#include <stdarg.h>
27
27
#include "errmsg.h"
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(drizzled::error::WARN,
42
_("syslog facility \"%s\" not known, using \"local0\""),
44
_facility= WrapSyslog::getFacilityByName("local0");
49
drizzled::errmsg_printf(drizzled::error::WARN,
50
_("syslog priority \"%s\" not known, using \"warn\""),
52
_priority= WrapSyslog::getPriorityByName("warn");
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);
56
bool error_message::Syslog::errmsg(drizzled::error::level_t, const char *format, va_list ap)
58
bool ErrorMessage_syslog::errmsg(drizzled::Session *,
60
const char *format, va_list ap)
58
WrapSyslog::singleton().vlog(_facility, _priority, format, ap);
62
if (syslog_module::sysvar_errmsg_enable == false)
64
WrapSyslog::singleton().vlog(syslog_facility, syslog_priority, format, ap);
62
} /* namespace drizzle_plugin */