From: Niki Roo Date: Sun, 12 May 2019 16:20:43 +0000 (+0200) Subject: add time in default trace handler X-Git-Tag: fanfix-3.0.1~29^2~67 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=96c3f6294046c5d003cb463d195db5cb6331f74f;p=fanfix.git add time in default trace handler --- diff --git a/src/be/nikiroo/utils/TraceHandler.java b/src/be/nikiroo/utils/TraceHandler.java index 12ae849..e1dc50f 100644 --- a/src/be/nikiroo/utils/TraceHandler.java +++ b/src/be/nikiroo/utils/TraceHandler.java @@ -91,6 +91,8 @@ public class TraceHandler { public void error(Exception e) { if (showErrors) { if (showErrorDetails) { + long now = System.currentTimeMillis(); + System.err.print(StringUtils.fromTime(now) + ": "); e.printStackTrace(); } else { error(e.getMessage()); @@ -106,7 +108,8 @@ public class TraceHandler { */ public void error(String message) { if (showErrors) { - System.err.println(message); + long now = System.currentTimeMillis(); + System.err.println(StringUtils.fromTime(now) + ": " + message); } } @@ -139,7 +142,10 @@ public class TraceHandler { */ public void trace(String message, int level) { if (traceLevel > 0 && level <= traceLevel) { + long now = System.currentTimeMillis(); + System.err.print(StringUtils.fromTime(now) + ": "); if (maxPrintSize > 0 && message.length() > maxPrintSize) { + System.err .println(message.substring(0, maxPrintSize) + "[...]"); } else {