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

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Jun 28 05:41:51 CEST 2012


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);
 	}
-- 
1.7.2.5




More information about the sheepdog mailing list