/* XXX if RHEL, enable the AUTODD feature by default,
* but we should come with more general way how to control this */
diff --git a/loader/log.c b/loader/log.c
index 0d1fa98..01abae8 100644
--- a/loader/log.c
+++ b/loader/log.c
@@ -30,12 +30,41 @@
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
+#include <syslog.h>
#include "log.h"
static FILE * tty_logfile = NULL;
static FILE * file_logfile = NULL;
static int minLevel = INFO;
+static const char * syslog_facility = "loader";
+
+/* maps our loglevel to syslog loglevel */
+static int mapLogLevel(int level)
+{
+ int syslog_level;
+ switch (level) {
+ case DEBUGLVL:
+ syslog_level = LOG_DEBUG;
+ break;
+ case INFO:
+ syslog_level = LOG_INFO;
+ break;
+ case WARNING:
+ syslog_level = LOG_WARNING;
+ break;
+ case CRITICAL:
+ syslog_level = LOG_CRIT;
+ break;
+ case ERROR:
+ default:
+ /* if someone called us with an invalid level value, log it as an error
+ too. */
+ syslog_level = LOG_ERR;
+ break;
+ }
+ return syslog_level;
+}
void openLog() {
- int flags;
+ /* init syslog logging (so loader messages can also be forwarded to a remote
+ syslog daemon */
+ openlog(syslog_facility, 0, LOG_LOCAL1);