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

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Oct 13 04:19:13 CEST 2011


At Wed, 12 Oct 2011 23:55:31 +0800,
Andychen wrote:
> 
> 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;

The variable definition should be at the start of the function block.

Looks good other than this.  I've applied these 5 patches after fixing
it, thanks!

Kazutaka

>  	va_start(ap, fmt);
>  	dolog(prio, func, line, fmt, ap);
> -- 
> 1.7.6.4
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list