Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
feat: migrate logger to slf4j
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 22, 2022
1 parent ce78b24 commit 6c4c192
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation(kotlin("reflect"))

implementation("app.revanced:revanced-patcher:1.6.0")
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("info.picocli:picocli:4.6.3")
implementation("com.android.tools.build:apksig:7.2.1")
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
import app.revanced.utils.adb.Adb
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import picocli.CommandLine.*
import java.io.File
import java.nio.file.Files
import java.util.logging.Logger
import kotlin.io.path.Path
import kotlin.io.path.name

@Command(
name = "ReVanced-CLI", version = ["1.0.0"], mixinStandardHelpOptions = true
)
internal object MainCommand : Runnable {
val logger: Logger = Logger.getLogger(MainCommand.javaClass.name)
val logger: Logger = LoggerFactory.getLogger(MainCommand::class.java)

@ArgGroup(exclusive = false, multiplicity = "1")
lateinit var args: Args
Expand Down Expand Up @@ -85,8 +86,6 @@ internal object MainCommand : Runnable {
}

override fun run() {
System.setProperty("java.util.logging.SimpleFormatter.format", "%4\$s: %5\$s %n")

if (args.lArgs?.listOnly == true) {
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
logger.info("${patch.patchName}: ${patch.description}")
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/app/revanced/utils/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun Patcher.addPatchesFiltered(
return@patch
}

if (compatiblePackages == null) logger.warning("$prefix: Missing compatibility annotation. Continuing.")
if (compatiblePackages == null) logger.warn("$prefix: Missing compatibility annotation. Continuing.")
else {
if (!compatiblePackages.any { it.name == packageName }) {
logger.info("$prefix: Incompatible package")
Expand Down Expand Up @@ -63,7 +63,7 @@ fun Patcher.applyPatchesVerbose() {

return@forEach
}
logger.severe("Error: $patch")
logger.error("Error: $patch")

result.exceptionOrNull()!!.printStackTrace()
}
Expand Down

0 comments on commit 6c4c192

Please sign in to comment.