git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New: new functions in UiUtils and IOUtils
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
TraceHandler.java
diff --git
a/src/be/nikiroo/utils/TraceHandler.java
b/src/be/nikiroo/utils/TraceHandler.java
index be9beeffd780af92c80f7ea16d389723b863419b..0a09712d5218013992493838c75ad9aa0ad92527 100644
(file)
--- a/
src/be/nikiroo/utils/TraceHandler.java
+++ b/
src/be/nikiroo/utils/TraceHandler.java
@@
-28,7
+28,7
@@
public class TraceHandler {
* @param showErrorDetails
* show more details when printing errors
* @param showTraces
* @param showErrorDetails
* show more details when printing errors
* @param showTraces
- * show level 1 traces on std
out
, or no traces at all
+ * show level 1 traces on std
err
, or no traces at all
*/
public TraceHandler(boolean showErrors, boolean showErrorDetails,
boolean showTraces) {
*/
public TraceHandler(boolean showErrors, boolean showErrorDetails,
boolean showTraces) {
@@
-91,9
+91,11
@@
public class TraceHandler {
public void error(Exception e) {
if (showErrors) {
if (showErrorDetails) {
public void error(Exception e) {
if (showErrors) {
if (showErrorDetails) {
+ long now = System.currentTimeMillis();
+ System.err.print(StringUtils.fromTime(now) + ": ");
e.printStackTrace();
} else {
e.printStackTrace();
} else {
- error(e.
getMessage
());
+ error(e.
toString
());
}
}
}
}
}
}
@@
-106,7
+108,8
@@
public class TraceHandler {
*/
public void error(String message) {
if (showErrors) {
*/
public void error(String message) {
if (showErrors) {
- System.err.println(message);
+ long now = System.currentTimeMillis();
+ System.err.println(StringUtils.fromTime(now) + ": " + message);
}
}
}
}
@@
-139,11
+142,14
@@
public class TraceHandler {
*/
public void trace(String message, int level) {
if (traceLevel > 0 && level <= traceLevel) {
*/
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) {
if (maxPrintSize > 0 && message.length() > maxPrintSize) {
- System.out
+
+ System.err
.println(message.substring(0, maxPrintSize) + "[...]");
} else {
.println(message.substring(0, maxPrintSize) + "[...]");
} else {
- System.
out
.println(message);
+ System.
err
.println(message);
}
}
}
}
}
}