X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FTraceHandler.java;h=0a09712d5218013992493838c75ad9aa0ad92527;hb=919bbc354cd2555eb0955be0ef2dcf338047d022;hp=d7f604667f8976c8afe595a81620b5665d4981aa;hpb=08a58812f12617289463b00161c98d7c59490bf2;p=fanfix.git diff --git a/src/be/nikiroo/utils/TraceHandler.java b/src/be/nikiroo/utils/TraceHandler.java deleted file mode 100644 index d7f6046..0000000 --- a/src/be/nikiroo/utils/TraceHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package be.nikiroo.utils; - -/** - * A handler when a trace message is sent or when a recoverable exception was - * caught by the program. - * - * @author niki - */ -public class TraceHandler { - private boolean showErrors; - private boolean showTraces; - private boolean showErrorDetails; - - /** - * Create a default {@link TraceHandler} that will print errors on stderr - * (without details) and no traces. - */ - public TraceHandler() { - this(true, false, false); - } - - /** - * Create a default {@link TraceHandler}. - * - * @param showErrors - * show errors on stderr - * @param showErrorDetails - * show more details when printing errors - * @param showTraces - * show traces on stdout - */ - public TraceHandler(boolean showErrors, boolean showErrorDetails, - boolean showTraces) { - this.showErrors = showErrors; - this.showErrorDetails = showErrorDetails; - this.showTraces = showTraces; - } - - /** - * An exception happened, log it. - * - * @param e - * the exception - */ - public void error(Exception e) { - if (showErrors) { - if (showErrorDetails) { - e.printStackTrace(); - } else { - error(e.getMessage()); - } - } - } - - /** - * An error happened, log it. - * - * @param message - * the error message - */ - public void error(String message) { - if (showErrors) { - System.err.println(message); - } - } - - /** - * A trace happened, show it. - *

- * Will only be effective if {@link TraceHandler#isShowTraces()} is true. - * - * @param message - * the trace message - */ - public void trace(String message) { - if (showTraces) { - System.out.println(message); - } - } -}