[Sheepdog] [PATCH 2/5] logger: fix log level not work problem

Andychen sanjie.cyg at taobao.com
Wed Oct 12 17:55:31 CEST 2011


From: Andy chen <sanjie.cyg at taobao.com>

now if we set log level when start sheep, the log level not work,
this patch fix this

Signed-off-by: Andychen <sanjie.cyg at taobao.com>
---
 lib/logger.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/logger.c b/lib/logger.c
index 5fbbd75..f76e9e7 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -318,9 +318,6 @@ static void dolog(int prio, const char *func, int line, const char *fmt, va_list
 			p += 3;
 		}
 
-		if (prio > log_level)
-			return;
-
 		if (log_name)
 			fprintf(stderr, "%s: %s(%d) %s", log_name, func, line, p);
 		else
@@ -332,6 +329,9 @@ static void dolog(int prio, const char *func, int line, const char *fmt, va_list
 
 void log_write(int prio, const char *func, int line, const char *fmt, ...)
 {
+	if (prio > log_level)
+		return;
+
 	va_list ap;
 	va_start(ap, fmt);
 	dolog(prio, func, line, fmt, ap);
-- 
1.7.6.4




More information about the sheepdog mailing list