From 46b494f26fff03b60efa52284e701478c005020c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 14 Oct 2014 18:33:37 +0200 Subject: [PATCH] java-decompiler: do not indent log by unprinted messages --- .../main/decompiler/PrintStreamLogger.java | 50 ++++++++++++------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java index 27a2c56..0995613 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java @@ -39,56 +39,72 @@ public class PrintStreamLogger extends IFernflowerLogger { @Override public void writeMessage(String message, Throwable t) { - writeMessage(message, Severity.ERROR); if (accepts(Severity.ERROR)) { + writeMessage(message, Severity.ERROR); t.printStackTrace(stream); } } @Override public void startReadingClass(String className) { - writeMessage("Decompiling class " + className, Severity.INFO); - ++indent; + if (accepts(Severity.INFO)) { + writeMessage("Decompiling class " + className, Severity.INFO); + ++indent; + } } @Override public void endReadingClass() { - --indent; - writeMessage("... done", Severity.INFO); + if (accepts(Severity.INFO)) { + --indent; + writeMessage("... done", Severity.INFO); + } } @Override public void startClass(String className) { - writeMessage("Processing class " + className, Severity.TRACE); - ++indent; + if (accepts(Severity.INFO)) { + writeMessage("Processing class " + className, Severity.TRACE); + ++indent; + } } @Override public void endClass() { - --indent; - writeMessage("... proceeded", Severity.TRACE); + if (accepts(Severity.INFO)) { + --indent; + writeMessage("... proceeded", Severity.TRACE); + } } @Override public void startMethod(String methodName) { - writeMessage("Processing method " + methodName, Severity.TRACE); - ++indent; + if (accepts(Severity.INFO)) { + writeMessage("Processing method " + methodName, Severity.TRACE); + ++indent; + } } public void endMethod() { - --indent; - writeMessage("... proceeded", Severity.TRACE); + if (accepts(Severity.INFO)) { + --indent; + writeMessage("... proceeded", Severity.TRACE); + } } @Override public void startWriteClass(String className) { - writeMessage("Writing class " + className, Severity.TRACE); - ++indent; + if (accepts(Severity.INFO)) { + writeMessage("Writing class " + className, Severity.TRACE); + ++indent; + } } @Override public void endWriteClass() { - --indent; - writeMessage("... written", Severity.TRACE); + if (accepts(Severity.INFO)) { + --indent; + writeMessage("... written", Severity.TRACE); + } } }