~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/syslog/module.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:
24
24
#include <drizzled/plugin/error_message.h>
25
25
#include <drizzled/plugin/function.h>
26
26
 
27
 
#include <plugin/syslog/wrap.h>
28
 
#include <plugin/syslog/logging.h>
29
 
#include <plugin/syslog/errmsg.h>
30
 
#include <plugin/syslog/function.h>
 
27
#include "wrap.h"
 
28
#include "logging.h"
 
29
#include "errmsg.h"
 
30
#include "function.h"
31
31
#include <iostream>
32
32
#include <boost/program_options.hpp>
33
33
#include <drizzled/module/option_map.h>
39
39
namespace drizzle_plugin
40
40
{
41
41
 
42
 
static bool sysvar_logging_enable= false;
43
 
static bool sysvar_errmsg_enable= true;
 
42
bool sysvar_logging_enable= false;
 
43
bool sysvar_errmsg_enable= false;
44
44
 
45
45
uint64_constraint sysvar_logging_threshold_slow;
46
46
uint64_constraint sysvar_logging_threshold_big_resultset;
54
54
  WrapSyslog::singleton().openlog(vm["ident"].as<string>());
55
55
  if (sysvar_errmsg_enable)
56
56
  {
57
 
    context.add(new error_message::Syslog(vm["facility"].as<string>()));
 
57
    context.add(new error_message::Syslog(vm["facility"].as<string>(),
 
58
                                          vm["errmsg-priority"].as<string>()));
58
59
  }
59
 
 
60
60
  if (sysvar_logging_enable)
61
61
  {
62
62
    context.add(new logging::Syslog(vm["facility"].as<string>(),
 
63
                                    vm["logging-priority"].as<string>(),
63
64
                                    sysvar_logging_threshold_slow.get(),
64
65
                                    sysvar_logging_threshold_big_resultset.get(),
65
66
                                    sysvar_logging_threshold_big_examined.get()));
66
67
  }
67
 
 
68
68
  context.add(new plugin::Create_function<udf::Syslog>("syslog"));
69
69
 
70
70
  context.registerVariable(new sys_var_const_string_val("facility",
112
112
          po::value<uint64_constraint>(&sysvar_logging_threshold_big_examined)->default_value(0),
113
113
          _("Threshold for logging big queries, for rows examined"));
114
114
  context("errmsg-enable",
115
 
          po::value<bool>(&sysvar_errmsg_enable)->default_value(true)->zero_tokens(),
 
115
          po::value<bool>(&sysvar_errmsg_enable)->default_value(false)->zero_tokens(),
116
116
          _("Enable logging to syslog of the error messages"));
117
117
  context("errmsg-priority",
118
118
          po::value<string>()->default_value("warning"),