mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-21 15:28:52 -05:00
Improved logging for large scripts passed in as argument messing up the log lines
This commit is contained in:
parent
4a19490f01
commit
aa7234982d
@ -3,6 +3,7 @@ package net.filebot;
|
||||
import static java.nio.channels.Channels.*;
|
||||
import static java.util.Arrays.*;
|
||||
import static java.util.stream.Collectors.*;
|
||||
import static net.filebot.util.RegularExpressions.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -96,6 +97,10 @@ public final class Logging {
|
||||
return () -> String.format(format, args);
|
||||
}
|
||||
|
||||
public static Supplier<String> formatSingleLine(String format, Object... args) {
|
||||
return () -> NEWLINE.splitAsStream(String.format(format, args)).map(String::trim).filter(s -> !s.isEmpty()).collect(joining(" ⏎ "));
|
||||
}
|
||||
|
||||
public static Supplier<String> trace(Throwable t) {
|
||||
return () -> {
|
||||
StringBuilder s = new StringBuilder();
|
||||
|
@ -891,7 +891,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
return input;
|
||||
}
|
||||
|
||||
log.fine(format("Apply filter [%s] on [%d] items", filter.getExpression(), input.size()));
|
||||
log.fine(formatSingleLine("Apply filter [%s] on [%d] items", filter.getExpression(), input.size()));
|
||||
|
||||
// support context bindings
|
||||
Map<File, ?> context = new EntryList<File, T>(null, input);
|
||||
@ -910,7 +910,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
return episodes;
|
||||
}
|
||||
|
||||
log.fine(format("Apply mapper [%s] on [%d] items", mapper.getExpression(), episodes.size()));
|
||||
log.fine(formatSingleLine("Apply mapper [%s] on [%d] items", mapper.getExpression(), episodes.size()));
|
||||
|
||||
// support episode list context
|
||||
Map<File, Episode> context = new EntryList<File, Episode>(null, episodes);
|
||||
|
Loading…
Reference in New Issue
Block a user