mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-17 16:33:58 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c183c38f2a | ||
|
|
d9c5a179c5 |
@@ -1,3 +1,10 @@
|
|||||||
|
## [2.5.3](https://github.com/revanced/revanced-cli/compare/v2.5.2...v2.5.3) (2022-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Log not showing in CLI ([#80](https://github.com/revanced/revanced-cli/issues/80)) ([d9c5a17](https://github.com/revanced/revanced-cli/commit/d9c5a179c529c386f66df4fa63cd321d396836b5)), closes [#79](https://github.com/revanced/revanced-cli/issues/79)
|
||||||
|
|
||||||
## [2.5.2](https://github.com/revanced/revanced-cli/compare/v2.5.1...v2.5.2) (2022-07-10)
|
## [2.5.2](https://github.com/revanced/revanced-cli/compare/v2.5.1...v2.5.2) (2022-07-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.5.2
|
version = 2.5.3
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ import app.revanced.cli.command.MainCommand
|
|||||||
import app.revanced.cli.logging.CliLogger
|
import app.revanced.cli.logging.CliLogger
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
import java.util.logging.SimpleFormatter
|
import java.util.logging.SimpleFormatter
|
||||||
import java.util.logging.StreamHandler
|
|
||||||
|
|
||||||
internal class DefaultCliLogger(
|
internal class DefaultCliLogger(
|
||||||
private val logger: Logger = Logger.getLogger(MainCommand::javaClass.name),
|
private val logger: Logger = Logger.getLogger(MainCommand::class.java.name),
|
||||||
private val errorLogger: Logger = Logger.getLogger(MainCommand::javaClass.name + "Err")
|
private val errorLogger: Logger = Logger.getLogger(logger.name + "Err")
|
||||||
) : CliLogger {
|
) : CliLogger {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
logger.useParentHandlers = false
|
logger.useParentHandlers = false
|
||||||
logger.addHandler(StreamHandler(System.out, SimpleFormatter()))
|
if (logger.handlers.isEmpty()) {
|
||||||
|
logger.addHandler(FlushingStreamHandler(System.out, SimpleFormatter()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
init {
|
init {
|
||||||
System.setProperty("java.util.logging.SimpleFormatter.format", "%4\$s: %5\$s %n")
|
System.setProperty("java.util.logging.SimpleFormatter.format", "%4\$s: %5\$s %n")
|
||||||
|
|||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import app.revanced.cli.logging.impl.DefaultCliLogger
|
|||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
internal object PatcherLogger : app.revanced.patcher.logging.Logger{
|
internal object PatcherLogger : app.revanced.patcher.logging.Logger{
|
||||||
private val logger = DefaultCliLogger(Logger.getLogger(app.revanced.patcher.Patcher::javaClass.name))
|
private val logger = DefaultCliLogger(Logger.getLogger(app.revanced.patcher.Patcher::class.java.name))
|
||||||
|
|
||||||
override fun error(msg: String) = logger.error(msg)
|
override fun error(msg: String) = logger.error(msg)
|
||||||
override fun info(msg: String) = logger.info(msg)
|
override fun info(msg: String) = logger.info(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user