{
pid_t pid;
+ ulog_open(ULOG_KMSG, LOG_DAEMON, "init");
+
sigaction(SIGTERM, &sa_shutdown, NULL);
sigaction(SIGUSR1, &sa_shutdown, NULL);
sigaction(SIGUSR2, &sa_shutdown, NULL);
#ifndef __LOG_H
#define __LOG_H
-#include <syslog.h>
+#include <libubox/ulog.h>
#define DEBUG(level, fmt, ...) do { \
if (debug >= level) { \
- syslog(0, fmt, ## __VA_ARGS__); \
- fprintf(stderr, "procd: %s(%d): " fmt, __func__, __LINE__, ## __VA_ARGS__); \
+ ulog(LOG_DEBUG, fmt, ## __VA_ARGS__); \
} } while (0)
-#define LOG(fmt, ...) do { \
- syslog(0, fmt, ## __VA_ARGS__); \
- fprintf(stderr, "procd: "fmt, ## __VA_ARGS__); \
- } while (0)
-
-#define ERROR(fmt, ...) do { \
- syslog(0, fmt, ## __VA_ARGS__); \
- fprintf(stderr, "procd: "fmt, ## __VA_ARGS__); \
- } while (0)
+#define LOG ULOG_INFO
+#define ERROR ULOG_ERR
extern unsigned int debug;
int ch;
char *dbglvl = getenv("DBGLVL");
+ ulog_open(ULOG_KMSG, LOG_DAEMON, "procd");
+
if (dbglvl) {
debug = atoi(dbglvl);
unsetenv("DBGLVL");
procd_inittab_run("askconsole");
procd_inittab_run("askfirst");
procd_inittab_run("sysinit");
+
+ // switch to syslog log channel
+ ulog_open(ULOG_SYSLOG, LOG_DAEMON, "procd");
break;
case STATE_RUNNING: