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

Andy chen sanjie.cyg at taobao.com
Fri Oct 14 04:55:39 CEST 2011


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

Signed-off-by: Andy chen <sanjie.cyg at taobao.com>
Signed-off-by: Yibin Shen <zituan at taobao.com>
---
 lib/logger.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/logger.c b/lib/logger.c
index 5fbbd75..7d64515 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
@@ -333,6 +330,10 @@ 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, ...)
 {
 	va_list ap;
+
+	if (prio > log_level)
+		return;
+
 	va_start(ap, fmt);
 	dolog(prio, func, line, fmt, ap);
 	va_end(ap);
-- 
1.7.7




More information about the sheepdog mailing list