java-decompiler: class name logging on non-fatal errors

master
Roman Shevchenko 10 years ago
parent d96104bdec
commit 1e3d5276a8
  1. 2
      src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
  2. 36
      src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java
  3. 20
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java

@ -236,6 +236,7 @@ public class ClassesProcessor {
return;
}
DecompilerContext.getLogger().startReadingClass(cl.qualifiedName);
try {
ImportCollector importCollector = new ImportCollector(root);
DecompilerContext.setImportCollector(importCollector);
@ -291,6 +292,7 @@ public class ClassesProcessor {
}
finally {
destroyWrappers(root);
DecompilerContext.getLogger().endReadingClass();
}
}

@ -33,7 +33,7 @@ public class PrintStreamLogger extends IFernflowerLogger {
@Override
public void writeMessage(String message, Severity severity) {
if (accepts(severity)) {
stream.println(InterpreterUtil.getIndentString(indent) + severity.name() + ": " + message);
stream.println(severity.prefix + InterpreterUtil.getIndentString(indent) + message);
}
}
@ -46,35 +46,49 @@ public class PrintStreamLogger extends IFernflowerLogger {
}
@Override
public void startClass(String className) {
writeMessage("Processing class " + className + " ...", Severity.INFO);
public void startReadingClass(String className) {
writeMessage("Decompiling class " + className, Severity.INFO);
++indent;
}
@Override
public void endClass() {
public void endReadingClass() {
--indent;
writeMessage("... proceeded.", Severity.INFO);
writeMessage("... done", Severity.INFO);
}
@Override
public void startWriteClass(String className) {
writeMessage("Writing class " + className + " ...", Severity.INFO);
public void startClass(String className) {
writeMessage("Processing class " + className, Severity.TRACE);
++indent;
}
@Override
public void endWriteClass() {
public void endClass() {
--indent;
writeMessage("... written.", Severity.INFO);
writeMessage("... proceeded", Severity.TRACE);
}
@Override
public void startMethod(String methodName) {
writeMessage("Processing method " + methodName + " ...", Severity.INFO);
writeMessage("Processing method " + methodName, Severity.TRACE);
++indent;
}
public void endMethod() {
writeMessage("... proceeded.", Severity.INFO);
--indent;
writeMessage("... proceeded", Severity.TRACE);
}
@Override
public void startWriteClass(String className) {
writeMessage("Writing class " + className, Severity.TRACE);
++indent;
}
@Override
public void endWriteClass() {
--indent;
writeMessage("... written", Severity.TRACE);
}
}

@ -18,7 +18,13 @@ package org.jetbrains.java.decompiler.main.extern;
public abstract class IFernflowerLogger {
public enum Severity {
TRACE, INFO, WARN, ERROR
TRACE("TRACE: "), INFO("INFO: "), WARN("WARN: "), ERROR("ERROR: ");
public final String prefix;
Severity(String prefix) {
this.prefix = prefix;
}
}
private Severity severity = Severity.INFO;
@ -35,15 +41,19 @@ public abstract class IFernflowerLogger {
public abstract void writeMessage(String message, Throwable t);
public void startClass(String className) { }
public void startReadingClass(String className) { }
public void endClass() { }
public void endReadingClass() { }
public void startWriteClass(String className) { }
public void startClass(String className) { }
public void endWriteClass() { }
public void endClass() { }
public void startMethod(String methodName) { }
public void endMethod() { }
public void startWriteClass(String className) { }
public void endWriteClass() { }
}

Loading…
Cancel
Save