diff --git a/src/main/kotlin/app/revanced/cli/logging/impl/DefaultCliLogger.kt b/src/main/kotlin/app/revanced/cli/logging/impl/DefaultCliLogger.kt index a433c4eb..6ad492c9 100644 --- a/src/main/kotlin/app/revanced/cli/logging/impl/DefaultCliLogger.kt +++ b/src/main/kotlin/app/revanced/cli/logging/impl/DefaultCliLogger.kt @@ -4,7 +4,6 @@ import app.revanced.cli.command.MainCommand import app.revanced.cli.logging.CliLogger import java.util.logging.Logger import java.util.logging.SimpleFormatter -import java.util.logging.StreamHandler internal class DefaultCliLogger( private val logger: Logger = Logger.getLogger(MainCommand::javaClass.name), @@ -13,7 +12,7 @@ internal class DefaultCliLogger( init { logger.useParentHandlers = false - logger.addHandler(StreamHandler(System.out, SimpleFormatter())) + logger.addHandler(FlushingStreamHandler(System.out, SimpleFormatter())) } companion object { init { diff --git a/src/main/kotlin/app/revanced/cli/logging/impl/FlushingStreamHandler.kt b/src/main/kotlin/app/revanced/cli/logging/impl/FlushingStreamHandler.kt new file mode 100644 index 00000000..4bfb3941 --- /dev/null +++ b/src/main/kotlin/app/revanced/cli/logging/impl/FlushingStreamHandler.kt @@ -0,0 +1,13 @@ +package app.revanced.cli.logging.impl + +import java.io.OutputStream +import java.util.logging.Formatter +import java.util.logging.LogRecord +import java.util.logging.StreamHandler + +internal class FlushingStreamHandler(out: OutputStream, format: Formatter) : StreamHandler(out, format) { + override fun publish(record: LogRecord) { + super.publish(record) + flush() + } +} \ No newline at end of file