Skip to content

Commit

Permalink
Merge branch 'clearLog'
Browse files Browse the repository at this point in the history
  • Loading branch information
basilevs committed Apr 3, 2024
2 parents bc3a2c3 + fe4241e commit 542a4e4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class ConsoleOutputListener implements AutLaunchListener {

private final LogBuilder log;
private AutLaunch launch = null;
private boolean logStarted = false;

public ConsoleOutputListener()
{
Expand Down Expand Up @@ -78,10 +79,11 @@ public void startLogging(AutLaunch launch) {
flushable.setBuffered(false); // Fixes OutOfMemoryError
}
}

logStarted = true;
}

public void stopLogging() {
logStarted = false;
AutLaunch launch2 = launch;
if (launch2 == null)
return;
Expand All @@ -91,6 +93,7 @@ public void stopLogging() {
flushable.setBuffered(true);
}
}
log.clear();
launch = null;
}

Expand All @@ -102,6 +105,9 @@ public void stateChanged(AutLaunch launch, AutLaunchState state) {
}

public String getLog() {
if (!logStarted) {
throw new IllegalStateException("Log is not started");
}
return log.toString();
}

Expand Down

0 comments on commit 542a4e4

Please sign in to comment.