mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-03 08:52:53 +01:00
fix: Filter logs correctly
BREAKING CHANGE: This changes the log handler signature
This commit is contained in:
parent
e3851d58c8
commit
43fc20d90e
@ -69,7 +69,7 @@ public final class app/revanced/lib/adb/AdbManager$UserAdbManager : app/revanced
|
||||
|
||||
public final class app/revanced/lib/logging/Logger {
|
||||
public static final field INSTANCE Lapp/revanced/lib/logging/Logger;
|
||||
public final fun addHandler (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V
|
||||
public final fun addHandler (Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V
|
||||
public final fun removeAllHandlers ()V
|
||||
public final fun setDefault ()V
|
||||
public final fun setFormat (Ljava/lang/String;)V
|
||||
|
@ -38,11 +38,15 @@ object Logger {
|
||||
* @param closeHandler The handler for closing the log.
|
||||
*/
|
||||
fun addHandler(
|
||||
publishHandler: (log: String, level: Level) -> Unit,
|
||||
publishHandler: (log: String, level: Level, loggerName: String?) -> Unit,
|
||||
flushHandler: () -> Unit,
|
||||
closeHandler: () -> Unit
|
||||
) = object : Handler() {
|
||||
override fun publish(record: LogRecord) = publishHandler(formatter.format(record), record.level)
|
||||
override fun publish(record: LogRecord) = publishHandler(
|
||||
formatter.format(record),
|
||||
record.level,
|
||||
record.loggerName
|
||||
)
|
||||
|
||||
override fun flush() = flushHandler()
|
||||
|
||||
@ -59,7 +63,9 @@ object Logger {
|
||||
setFormat()
|
||||
removeAllHandlers()
|
||||
|
||||
val publishHandler = { log: String, level: Level ->
|
||||
val publishHandler = handler@{ log: String, level: Level, loggerName: String? ->
|
||||
if (loggerName?.startsWith("app.revanced") != true) return@handler
|
||||
|
||||
log.toByteArray().let {
|
||||
if (level.intValue() > Level.INFO.intValue())
|
||||
System.err.write(it)
|
||||
|
Loading…
Reference in New Issue
Block a user