X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsyslog.c;h=a21bef18e180a3c63c1bf6966effc77f26a0518b;hb=6acb19befc321c501e4d8b79f403ebda0c021acc;hp=9ad26085972a92142dffd22e032a53f345248b58;hpb=cfb8c142cd23432d965f00a69cc9337168916c90;p=collectd.git diff --git a/src/syslog.c b/src/syslog.c index 9ad26085..a21bef18 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -28,7 +28,11 @@ # include #endif +#if COLLECT_DEBUG static int log_level = LOG_DEBUG; +#else +static int log_level = LOG_INFO; +#endif /* COLLECT_DEBUG */ static const char *config_keys[] = { @@ -64,19 +68,12 @@ static int sl_config (const char *key, const char *value) return (0); } /* int sl_config */ -static int sl_init (void) -{ - openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON); - - return (0); -} - -static void sl_log (int sevetiry, const char *msg) +static void sl_log (int severity, const char *msg) { - if (sevetiry > log_level) + if (severity > log_level) return; - syslog (sevetiry, "%s", msg); + syslog (severity, "%s", msg); } /* void sl_log */ static int sl_shutdown (void) @@ -88,10 +85,9 @@ static int sl_shutdown (void) void module_register (void) { + openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON); + plugin_register_config ("syslog", sl_config, config_keys, config_keys_num); - plugin_register_init ("syslog", sl_init); plugin_register_log ("syslog", sl_log); plugin_register_shutdown ("syslog", sl_shutdown); - - return; } /* void module_register(void) */