revanced-cli/src/main/kotlin/app/revanced/cli/logging/impl/FlushingStreamHandler.kt
EdgE790 d9c5a179c5
fix: Log not showing in CLI (#80)
* Fix #79. Changed from default StreamHandler to FlushingStreamHandler which flushes after every log statement

* Added removal of handlers, so they will not be duplicated.

* Replaced removal of handlers with addition only in case if there are no handlers already.
Changed errorLogger name from hardcoded to reusing previous logger name, so it will have the same name if only first parameter is used.

* Replaced calls ::javaClass.name to ::class.java.name to have proper class names in loggers
2022-07-11 14:25:17 +02:00

13 lines
382 B
Kotlin

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()
}
}