Skip to content

Commit

Permalink
log interceptor patches
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 2, 2021
1 parent 8a08424 commit 023a0c6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Disabled by default in config.yml
*/
public class LogInterceptor extends PrintStream {
boolean redirected = false;
public boolean redirected = false;
public PrintStream standardOut;

public LogInterceptor() {
Expand Down Expand Up @@ -43,20 +43,24 @@ public void print(char[] buf) {
print(new String(buf));
}

private boolean antiLoop = false;
public boolean antiLoop = false;

public void redirectOutput() {
if (redirected) {
return;
}
standardOut = System.out;
redirected = true;
if (System.out != this) {
standardOut = System.out;
}
System.setOut(this);
}

public void standardOutput() {
if (!redirected) {
return;
}
redirected = false;
System.setOut(standardOut);
}
}

0 comments on commit 023a0c6

Please sign in to comment.