mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-09-05 22:15:22 +02:00
feat: migrate logger to slf4j
This commit is contained in:
parent
ce78b245d1
commit
6c4c1924ee
@ -33,6 +33,7 @@ dependencies {
|
|||||||
implementation(kotlin("reflect"))
|
implementation(kotlin("reflect"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:1.6.0")
|
implementation("app.revanced:revanced-patcher:1.6.0")
|
||||||
|
implementation("org.slf4j:slf4j-api:1.7.36")
|
||||||
implementation("info.picocli:picocli:4.6.3")
|
implementation("info.picocli:picocli:4.6.3")
|
||||||
implementation("com.android.tools.build:apksig:7.2.1")
|
implementation("com.android.tools.build:apksig:7.2.1")
|
||||||
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
||||||
|
@ -8,10 +8,11 @@ import app.revanced.patcher.extensions.PatchExtensions.description
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||||
import app.revanced.utils.adb.Adb
|
import app.revanced.utils.adb.Adb
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
import picocli.CommandLine.*
|
import picocli.CommandLine.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.logging.Logger
|
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
import kotlin.io.path.name
|
import kotlin.io.path.name
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ import kotlin.io.path.name
|
|||||||
name = "ReVanced-CLI", version = ["1.0.0"], mixinStandardHelpOptions = true
|
name = "ReVanced-CLI", version = ["1.0.0"], mixinStandardHelpOptions = true
|
||||||
)
|
)
|
||||||
internal object MainCommand : Runnable {
|
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")
|
@ArgGroup(exclusive = false, multiplicity = "1")
|
||||||
lateinit var args: Args
|
lateinit var args: Args
|
||||||
@ -85,8 +86,6 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
System.setProperty("java.util.logging.SimpleFormatter.format", "%4\$s: %5\$s %n")
|
|
||||||
|
|
||||||
if (args.lArgs?.listOnly == true) {
|
if (args.lArgs?.listOnly == true) {
|
||||||
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
|
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
|
||||||
logger.info("${patch.patchName}: ${patch.description}")
|
logger.info("${patch.patchName}: ${patch.description}")
|
||||||
|
@ -35,7 +35,7 @@ fun Patcher.addPatchesFiltered(
|
|||||||
return@patch
|
return@patch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compatiblePackages == null) logger.warning("$prefix: Missing compatibility annotation. Continuing.")
|
if (compatiblePackages == null) logger.warn("$prefix: Missing compatibility annotation. Continuing.")
|
||||||
else {
|
else {
|
||||||
if (!compatiblePackages.any { it.name == packageName }) {
|
if (!compatiblePackages.any { it.name == packageName }) {
|
||||||
logger.info("$prefix: Incompatible package")
|
logger.info("$prefix: Incompatible package")
|
||||||
@ -63,7 +63,7 @@ fun Patcher.applyPatchesVerbose() {
|
|||||||
|
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
logger.severe("Error: $patch")
|
logger.error("Error: $patch")
|
||||||
|
|
||||||
result.exceptionOrNull()!!.printStackTrace()
|
result.exceptionOrNull()!!.printStackTrace()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user