Skip to content

Commit

Permalink
fix debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
Geosearchef committed Oct 30, 2018
1 parent 79d0581 commit 4c00e88
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.faforever.iceadapter.debug;

import ch.qos.logback.core.OutputStreamAppender;
import javafx.application.Platform;

import java.io.FilterOutputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -43,7 +44,6 @@ public void write(int b) {
if(! buffer.isEmpty()) {
buffer.clear();
}
return;
}

if(textArea != null) {
Expand All @@ -57,12 +57,14 @@ public void write(int b) {
}

private void appendText(String text) {
try {
textAreaAppendMethod.invoke(textArea, text);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
throw new RuntimeException("Could not append log to textArea");
}
Platform.runLater(() -> {
try {
textAreaAppendMethod.invoke(textArea, text);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
throw new RuntimeException("Could not append log to textArea");
}
});
}

public void setTextArea(Object textArea) {
Expand Down

0 comments on commit 4c00e88

Please sign in to comment.