[sheepdog] [PATCH] logger: show thread name when logging to stdout

Liu Yuan namei.unix at gmail.com
Thu Jun 28 08:40:43 CEST 2012


On 06/28/2012 11:41 AM, MORITA Kazutaka wrote:
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
>  lib/logger.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/logger.c b/lib/logger.c
> index e16ac8a..c64aefc 100644
> --- a/lib/logger.c
> +++ b/lib/logger.c
> @@ -323,10 +323,11 @@ static notrace void dolog(int prio, const char *func, int line,
>  
>  		vsnprintf(p, MAX_MSG_SIZE, fmt, ap);
>  
> -		if (log_name)
> -			fprintf(stderr, "%s: %s(%d) %s", log_name, func, line, p);
> +		if (worker_name)
> +			fprintf(stderr, "[%s %d] %s(%d) %s", worker_name,
> +				worker_idx, func, line, p);
>  		else
> -			fprintf(stderr, "%s(%d) %s", func, line, p);
> +			fprintf(stderr, "[main] %s(%d) %s", func, line, p);
>  
>  		fflush(stderr);
>  	}
> 

Applied, thanks.

Yuan




More information about the sheepdog mailing list