diff --git a/src/plugins/syslog.c b/src/plugins/syslog.c
index 02c62414b6856cd7003c1fd677f312007826b1ce..248ba8ef5c1d208c9a3c0292cd95e4bfdae7ba01 100644 (file)
--- a/src/plugins/syslog.c
+++ b/src/plugins/syslog.c
* plugin API
*/
-static int
-sdb_syslog_init(sdb_object_t __attribute__((unused)) *user_data)
-{
- openlog("sysdbd", LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_DAEMON);
- return 0;
-} /* sdb_syslog_init */
-
static int
sdb_syslog_log(int prio, const char *msg,
sdb_object_t __attribute__((unused)) *user_data)
{
+ /* XXX: make the log-level configurable */
+ if (prio >= SDB_LOG_DEBUG)
+ return 0;
syslog(SDB_LOG_PRIO_TO_SYSLOG(prio), "%s", msg);
return 0;
} /* sdb_syslog_log */
sdb_plugin_set_info(info, SDB_PLUGIN_INFO_VERSION, SDB_VERSION);
sdb_plugin_set_info(info, SDB_PLUGIN_INFO_PLUGIN_VERSION, SDB_VERSION);
- sdb_plugin_register_init("main", sdb_syslog_init, NULL);
+ if (info)
+ openlog("sysdbd", LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_DAEMON);
+
sdb_plugin_register_log("main", sdb_syslog_log, NULL);
sdb_plugin_register_shutdown("main", sdb_syslog_shutdown, NULL);
return 0;