From d574ea185678ac4cd8bfc68a10d52b19a5f37d93 Mon Sep 17 00:00:00 2001 From: Dakara Date: Tue, 5 Jun 2018 19:37:55 -0400 Subject: [PATCH] fix logging of thread when not configured --- .../dakaraphi/devtools/tracing/ApplicationHooks.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dakaraphi.devtools.tracing/src/main/java/dakaraphi/devtools/tracing/ApplicationHooks.java b/dakaraphi.devtools.tracing/src/main/java/dakaraphi/devtools/tracing/ApplicationHooks.java index 6a8e7fe..09d143f 100644 --- a/dakaraphi.devtools.tracing/src/main/java/dakaraphi/devtools/tracing/ApplicationHooks.java +++ b/dakaraphi.devtools.tracing/src/main/java/dakaraphi/devtools/tracing/ApplicationHooks.java @@ -41,10 +41,13 @@ public static void writeLog(Tracer tracerConfig, String text) { String time = new java.text.SimpleDateFormat("hh:mm:ss,SSS").format(new java.util.Date()); builder.append(time); if (tracerConfig.name != null) builder.append(" [" +tracerConfig.name+ "]"); - builder.append(" thread:["); - if (logConfig.threadId) builder.append(Thread.currentThread().getId()); - if (logConfig.threadName) builder.append(Thread.currentThread().getName()); - builder.append("]: "); + if (logConfig.threadId || logConfig.threadName) { + builder.append(" thread:["); + if (logConfig.threadId) builder.append(Thread.currentThread().getId()); + if (logConfig.threadName) builder.append(Thread.currentThread().getName()); + builder.append("]:"); + } + builder.append(' '); builder.append(text); if (tracerConfig.logStackFrames != null) appendStackFrames(tracerConfig.logStackFrames, builder);