1 package be
.nikiroo
.utils
;
4 * A handler when a trace message is sent or when a recoverable exception was
5 * caught by the program.
9 public class TraceHandler
{
10 private boolean showErrorDetails
;
11 private boolean showTraces
;
14 * Show more details (usually equivalent to the value of DEBUG).
16 * @return TRUE or FALSE
18 public boolean isShowErrorDetails() {
19 return showErrorDetails
;
23 * Show more details (usually equivalent to the value of DEBUG).
25 * @param showErrorDetails
28 public void setShowErrorDetails(boolean showErrorDetails
) {
29 this.showErrorDetails
= showErrorDetails
;
35 * @return TRUE or FALSE
37 public boolean isShowTraces() {
47 public void setShowTraces(boolean showTraces
) {
48 this.showTraces
= showTraces
;
52 * An exception happened, log it.
57 public void error(Exception e
) {
58 if (isShowErrorDetails()) {
61 error(e
.getMessage());
66 * An error happened, log it.
71 public void error(String message
) {
72 System
.err
.println(message
);
76 * A trace happened, show it.
78 * Will only be effective if {@link TraceHandler#isShowTraces()} is true.
83 public void trace(String message
) {
85 System
.out
.println(message
);