bindings/erlang: Added README.
[collectd.git] / src / syslog.c
index 3123e89..ace9dc6 100644 (file)
 # include <syslog.h>
 #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;
@@ -88,10 +86,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_log ("syslog", sl_log, /* user_data = */ NULL);
        plugin_register_shutdown ("syslog", sl_shutdown);
-
-       return;
 } /* void module_register(void) */