~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/syslog/errmsg.cc

  • Committer: Mark Atwood
  • Date: 2011-10-08 04:50:51 UTC
  • mfrom: (2430.1.1 rf)
  • Revision ID: me@mark.atwood.name-20111008045051-6ha1qiy7k2a9c3jv
Tags: 2011.10.27
mergeĀ lp:~olafvdspek/drizzle/refactor2

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <drizzled/gettext.h>
23
23
#include <drizzled/errmsg_print.h>
24
24
 
25
 
#include <cstdarg>
 
25
#include <stdarg.h>
26
26
 
27
 
#include <plugin/syslog/errmsg.h>
28
 
#include <plugin/syslog/wrap.h>
 
27
#include "errmsg.h"
 
28
#include "wrap.h"
29
29
 
30
30
namespace drizzle_plugin
31
31
{
32
32
 
33
 
error_message::Syslog::Syslog(const std::string& facility) :
 
33
error_message::Syslog::Syslog(const std::string& facility,
 
34
                              const std::string& priority) :
34
35
  drizzled::plugin::ErrorMessage("Syslog"),
35
 
  _facility(WrapSyslog::getFacilityByName(facility.c_str()))
 
36
  _facility(WrapSyslog::getFacilityByName(facility.c_str())),
 
37
  _priority(WrapSyslog::getPriorityByName(priority.c_str()))
36
38
{
37
39
  if (_facility == -1)
38
40
  {
41
43
                            facility.c_str());
42
44
    _facility= WrapSyslog::getFacilityByName("local0");
43
45
  }
 
46
 
 
47
  if (_priority == -1)
 
48
  {
 
49
    drizzled::errmsg_printf(drizzled::error::WARN,
 
50
                            _("syslog priority \"%s\" not known, using \"warn\""),
 
51
                            priority.c_str());
 
52
    _priority= WrapSyslog::getPriorityByName("warn");
 
53
  }
44
54
}
45
55
 
46
 
bool error_message::Syslog::errmsg(drizzled::error::priority_t priority, const char *format, va_list ap)
 
56
bool error_message::Syslog::errmsg(drizzled::error::level_t, const char *format, va_list ap)
47
57
{
48
 
  WrapSyslog::singleton().vlog(_facility, priority, format, ap);
 
58
  WrapSyslog::singleton().vlog(_facility, _priority, format, ap);
49
59
  return false;
50
60
}
51
61