Skip to content

Commit

Permalink
Only log renderer output when there was an error
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Oct 19, 2016
1 parent 2c7c688 commit 8beaf50
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/faustedition/gen/DiplomaticConversion.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.Stream.Builder;

Expand Down Expand Up @@ -126,10 +127,10 @@ public boolean buildSVGs() {
final Process renderProcess = new ProcessBuilder(arguments).redirectErrorStream(true).start();
final BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(new BufferedInputStream(renderProcess.getInputStream())));
bufferedReader.lines().forEach(line -> logger.warning(line + "[" + this + "]"));
String scriptOutput = bufferedReader.lines().collect(Collectors.joining("\n"));
int exitCode = renderProcess.waitFor();
if (exitCode != 0) {
logger.log(Level.SEVERE, MessageFormat.format("Failed to convert SVG for {0}: Exit Code {1}", document.base.resolve(page), exitCode));
logger.log(Level.SEVERE, MessageFormat.format("Failed to convert SVG for {0}: Exit Code {1}. Script output:\n{2}", document.base.resolve(page), exitCode, scriptOutput));
}
return exitCode != 0;
} catch (IOException | InterruptedException e) {
Expand Down

0 comments on commit 8beaf50

Please sign in to comment.