Skip to content

Commit

Permalink
fix: only enable logging for ReVanced
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Aug 14, 2023
1 parent 8fb2f2d commit 783ccf8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Expand Up @@ -28,6 +28,7 @@ import java.io.Closeable
import java.io.File
import java.io.OutputStream
import java.nio.file.Files
import java.util.logging.Level
import java.util.logging.LogManager

internal val NAMER = BasicDexFileNamer()
Expand Down Expand Up @@ -55,10 +56,14 @@ class Patcher(private val options: PatcherOptions) {

init {
// Disable unwanted logging.
LogManager.getLogManager().let {
listOf("app.revanced.apktool-lib", "app.revanced.brut.*").forEach { loggerName ->
it.getLogger(loggerName)?.useParentHandlers = false
}
LogManager.getLogManager().let { manager ->
manager.getLogger("").level = Level.OFF // Disable root logger.
// Enable only ReVanced logging.
manager.loggerNames
.toList()
.filter { it.startsWith("app.revanced") }
.map { manager.getLogger(it) }
.forEach { it.level = Level.INFO }
}

logger.info("Reading dex files")
Expand Down

0 comments on commit 783ccf8

Please sign in to comment.