From c20dfe12d5c737264b844e6634de11bf1e1629f0 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 23 Jun 2022 02:10:27 +0200 Subject: [PATCH] feat: improve logging --- src/main/kotlin/app/revanced/patcher/Patcher.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index c62ead1..7f878fa 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -62,7 +62,7 @@ class Patcher(private val options: PatcherOptions) { val packageMetadata = PackageMetadata() if (options.patchResources) { - logger.info("Decoding resources using Androlib, this may take a long time...") + logger.info("Decoding resources") // decode resources to cache directory androlib.decodeManifestWithResources(extInputFile, outDir, resourceTable) @@ -78,7 +78,7 @@ class Patcher(private val options: PatcherOptions) { } } else { - logger.info("Decoding AndroidManifest.xml manually because resource patching is disabled") + logger.info("Only decoding AndroidManifest.xml because resource patching is disabled") // create decoder for the resource table val decoder = ResAttrDecoder() @@ -102,7 +102,7 @@ class Patcher(private val options: PatcherOptions) { packageMetadata.metaInfo.versionInfo = resourceTable.versionInfo packageMetadata.metaInfo.sdkInfo = resourceTable.sdkInfo - logger.info("Reading input as dex file") + logger.info("Reading dex files") // read dex files val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null) @@ -164,7 +164,6 @@ class Patcher(private val options: PatcherOptions) { var resourceFile: File? = null if (options.patchResources) { - logger.info("Patching resources") val cacheDirectory = ExtFile(options.resourceCacheDirectory) val androlibResources = AndrolibResources().also { resources -> @@ -197,7 +196,7 @@ class Patcher(private val options: PatcherOptions) { ) }.toTypedArray() - logger.trace("Packaging using aapt") + logger.info("Compiling resources") androlibResources.aaptPackage( aaptFile, manifestFile, resDirectory, null, null, includedFiles ) @@ -251,8 +250,6 @@ class Patcher(private val options: PatcherOptions) { ): PatchResult { val patchName = patch.patchName - logger.trace("Applying patch $patchName") - // if the patch has already applied silently skip it if (appliedPatches.contains(patchName)) { logger.trace("Skipping patch $patchName because it has already been applied") @@ -317,7 +314,7 @@ class Patcher(private val options: PatcherOptions) { Result.failure(patchResult.error()!!) } - yield(patch.name to result) + yield(patch.patchName to result) if (stopOnError && patchResult.isError()) break } }