mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-21 23:38:50 -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.nio.channels.Channels.*;
|
||||||
import static java.util.Arrays.*;
|
import static java.util.Arrays.*;
|
||||||
import static java.util.stream.Collectors.*;
|
import static java.util.stream.Collectors.*;
|
||||||
|
import static net.filebot.util.RegularExpressions.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -96,6 +97,10 @@ public final class Logging {
|
|||||||
return () -> String.format(format, args);
|
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) {
|
public static Supplier<String> trace(Throwable t) {
|
||||||
return () -> {
|
return () -> {
|
||||||
StringBuilder s = new StringBuilder();
|
StringBuilder s = new StringBuilder();
|
||||||
|
@ -891,7 +891,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
return input;
|
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
|
// support context bindings
|
||||||
Map<File, ?> context = new EntryList<File, T>(null, input);
|
Map<File, ?> context = new EntryList<File, T>(null, input);
|
||||||
@ -910,7 +910,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
return episodes;
|
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
|
// support episode list context
|
||||||
Map<File, Episode> context = new EntryList<File, Episode>(null, episodes);
|
Map<File, Episode> context = new EntryList<File, Episode>(null, episodes);
|
||||||
|
Loading…
Reference in New Issue
Block a user