X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsyslog.c;h=ace9dc6f090e1a98a8bc3a0d4d08a25b39f6f21b;hb=4858a84e3e51830a103a5ff4aee6b844b708ce62;hp=d643e39a4f195d4556ee170113ef1d4b56a5db93;hpb=dc80c73c20ef0e69c3850fd9679a827ad79e61a1;p=collectd.git diff --git a/src/syslog.c b/src/syslog.c index d643e39a..ace9dc6f 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,14 +68,8 @@ 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 severity, const char *msg) +static void sl_log (int severity, const char *msg, + user_data_t __attribute__((unused)) *user_data) { if (severity > log_level) return; @@ -86,10 +84,11 @@ static int sl_shutdown (void) return (0); } -void module_register (modreg_e load) +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_log ("syslog", sl_log, /* user_data = */ NULL); plugin_register_shutdown ("syslog", sl_shutdown); } /* void module_register(void) */