[Sheepdog] [PATCH 3/5] logger: redefine sheep log priorities
Andychen
sanjie.cyg at taobao.com
Wed Oct 12 17:55:32 CEST 2011
From: Andy chen <sanjie.cyg at taobao.com>
Signed-off-by: Andychen <sanjie.cyg at taobao.com>
---
include/logger.h | 19 +++++++++++--------
lib/logger.c | 2 +-
sheep/sheep.c | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/logger.h b/include/logger.h
index 9ce5d5e..cdd7642 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -52,14 +52,17 @@ extern void dump_logmsg (void *);
extern void log_write(int prio, const char *func, int line, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
-#define SDOG_EMERG "<0>"
-#define SDOG_ALERT "<1>"
-#define SDOG_CRIT "<2>"
-#define SDOG_ERR "<3>"
-#define SDOG_WARNING "<4>"
-#define SDOG_NOTICE "<5>"
-#define SDOG_INFO "<6>"
-#define SDOG_DEBUG "<7>"
+/*
++ * sheep log priorities, comliant with syslog spec
++ */
+#define SDOG_EMERG LOG_EMERG
+#define SDOG_ALERT LOG_ALERT
+#define SDOG_CRIT LOG_CRIT
+#define SDOG_ERR LOG_ERR
+#define SDOG_WARNING LOG_WARNING
+#define SDOG_NOTICE LOG_NOTICE
+#define SDOG_INFO LOG_INFO
+#define SDOG_DEBUG LOG_DEBUG
#define vprintf(fmt, args...) \
do { \
diff --git a/lib/logger.c b/lib/logger.c
index f76e9e7..688c9b8 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -46,7 +46,7 @@ static void dolog(int prio, const char *func, int line, const char *fmt,
static struct logarea *la;
static char *log_name;
-static int log_level = LOG_INFO;
+static int log_level = SDOG_INFO;
static pid_t pid;
static key_t semkey;
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 0a73587..563d700 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -96,7 +96,7 @@ int main(int argc, char **argv)
break;
case 'd':
/* removed soon. use loglevel instead */
- log_level = LOG_DEBUG;
+ log_level = SDOG_DEBUG;
break;
case 'D':
dprintf("direct IO mode\n");
--
1.7.6.4
More information about the sheepdog
mailing list