Skip to content

Commit

Permalink
refactor: verbose doesn't adapt handler (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Sep 3, 2023
1 parent c7915cd commit dcb6788
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,18 @@ private static void setupLogging(final Verbosity verbosity) {
return;
}

Handler handler = new Handler(){
Handler handler = new Handler() {
@Override
public void publish(LogRecord record) {
if (getFormatter() == null) {
setFormatter(new SimpleFormatter());
setFormatter(new Formatter() {
@Override
public String format(LogRecord record) {
return record.getLevel().toString().charAt(0) + ": "
+ record.getMessage()
+ System.getProperty("line.separator");
}
});
}

try {
Expand All @@ -616,6 +623,7 @@ public void publish(LogRecord record) {
reportError(null, exception, ErrorManager.FORMAT_FAILURE);
}
}

@Override
public void close() throws SecurityException {}
@Override
Expand All @@ -627,15 +635,6 @@ public void flush(){}
if (verbosity == Verbosity.VERBOSE) {
handler.setLevel(Level.ALL);
logger.setLevel(Level.ALL);
} else {
handler.setFormatter(new Formatter() {
@Override
public String format(LogRecord record) {
return record.getLevel().toString().charAt(0) + ": "
+ record.getMessage()
+ System.getProperty("line.separator");
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private void readStagedAliasSpec() throws IOException {
mHeader.checkForUnreadHeader(mIn);

for (int i = 0; i < count; i++) {
LOGGER.fine(String.format("Skipping staged alias stagedId (%h) finalId: %h", mIn.readInt(), mIn.readInt()));
LOGGER.fine(String.format("Staged alias: 0x%08x -> 0x%08x", mIn.readInt(), mIn.readInt()));
}
}

Expand Down

0 comments on commit dcb6788

Please sign in to comment.