Switch to ulog for logging and add few commandline params
[project/ugps.git] / log.h
diff --git a/log.h b/log.h
index b8ae621..bf86f1e 100644 (file)
--- a/log.h
+++ b/log.h
 #ifndef __LOG_H
 #define __LOG_H
 
-#include <stdio.h>
-#include <syslog.h>
+#include <libubox/ulog.h>
 
-#define LOG(fmt, ...) do { \
-               syslog(LOG_INFO, fmt, ## __VA_ARGS__); \
-               fprintf(stderr, "ugps: "fmt, ## __VA_ARGS__); \
-       } while (0)
+#define DEBUG(level, fmt, ...) do { \
+       if (debug >= level) { \
+               ulog(LOG_DEBUG, fmt, ## __VA_ARGS__); \
+       } while (0)
 
-#define ERROR(fmt, ...) do { \
-               syslog(LOG_ERR, fmt, ## __VA_ARGS__); \
-               fprintf(stderr, "ugps: "fmt, ## __VA_ARGS__); \
-       } while (0)
+#define LOG   ULOG_INFO
+#define ERROR ULOG_ERR
 
 extern unsigned int debug;