mirror of
https://github.com/ReVanced/revanced-library.git
synced 2026-01-11 05:46:17 +00:00
feat: Log warnings when compiling resources
The logger in class `brut.util.OS` is responsible for logging the standard error output stream from invoking AAPT. Previously,only loggers with the name starting with `app.revanced` were shown.
This commit is contained in:
@@ -7,6 +7,14 @@ import java.util.logging.SimpleFormatter
|
|||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
object Logger {
|
object Logger {
|
||||||
|
/**
|
||||||
|
* Rules for allowed loggers.
|
||||||
|
*/
|
||||||
|
private val allowedLoggersRules = arrayOf<String.() -> Boolean>(
|
||||||
|
{ startsWith("app.revanced") }, // ReVanced loggers.
|
||||||
|
{ this == "" } // Logs warnings when compiling resources (Logger in class brut.util.OS).
|
||||||
|
)
|
||||||
|
|
||||||
private val rootLogger = java.util.logging.Logger.getLogger("")
|
private val rootLogger = java.util.logging.Logger.getLogger("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +72,9 @@ object Logger {
|
|||||||
removeAllHandlers()
|
removeAllHandlers()
|
||||||
|
|
||||||
val publishHandler = handler@{ log: String, level: Level, loggerName: String? ->
|
val publishHandler = handler@{ log: String, level: Level, loggerName: String? ->
|
||||||
if (loggerName?.startsWith("app.revanced") != true) return@handler
|
loggerName?.let { name ->
|
||||||
|
if (allowedLoggersRules.none { it(name) }) return@handler
|
||||||
|
}
|
||||||
|
|
||||||
log.toByteArray().let {
|
log.toByteArray().let {
|
||||||
if (level.intValue() > Level.WARNING.intValue())
|
if (level.intValue() > Level.WARNING.intValue())
|
||||||
|
|||||||
Reference in New Issue
Block a user