java-decompiler: do not indent log by unprinted messages
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 14 Oct 2014 16:33:37 +0000 (18:33 +0200)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 14 Oct 2014 16:33:37 +0000 (18:33 +0200)
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java

index 27a2c56a62b4b73d61851f57493df68590a8f742..099561310942954416c760905a11c9075f7fd9db 100644 (file)
@@ -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);
+    }
   }
 }