mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
refactor(logs): use consistent tag
This commit is contained in:
parent
36c4e2dfe0
commit
9f46f74357
5 changed files with 20 additions and 14 deletions
|
@ -4,11 +4,11 @@ import android.util.Log
|
|||
import app.revanced.manager.compose.network.utils.APIError
|
||||
import app.revanced.manager.compose.network.utils.APIFailure
|
||||
import app.revanced.manager.compose.network.utils.APIResponse
|
||||
import app.revanced.manager.compose.util.tag
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
import io.ktor.http.*
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
/**
|
||||
|
@ -39,11 +39,11 @@ class HttpService(
|
|||
null
|
||||
}
|
||||
|
||||
Log.e("ReVanced Manager", "Failed to fetch: API error, http status: ${response.status}, body: $body")
|
||||
Log.e(tag, "Failed to fetch: API error, http status: ${response.status}, body: $body")
|
||||
APIResponse.Error(APIError(response.status, body))
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
Log.e("ReVanced Manager", "Failed to fetch: error: $t, body: $body")
|
||||
Log.e(tag, "Failed to fetch: error: $t, body: $body")
|
||||
APIResponse.Failure(APIFailure(t, body))
|
||||
}
|
||||
return response
|
||||
|
|
|
@ -2,6 +2,7 @@ package app.revanced.manager.compose.patcher
|
|||
|
||||
import android.util.Log
|
||||
import app.revanced.manager.compose.patcher.worker.Progress
|
||||
import app.revanced.manager.compose.util.tag
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.data.Context
|
||||
|
@ -82,20 +83,21 @@ class Session(
|
|||
}
|
||||
|
||||
private object LogcatLogger : Logger {
|
||||
private const val tag = "revanced-patcher"
|
||||
fun String.fmt() = "[Patcher]: $this"
|
||||
|
||||
override fun error(msg: String) {
|
||||
Log.e(tag, msg)
|
||||
Log.e(tag, msg.fmt())
|
||||
}
|
||||
|
||||
override fun warn(msg: String) {
|
||||
Log.w(tag, msg)
|
||||
Log.w(tag, msg.fmt())
|
||||
}
|
||||
|
||||
override fun info(msg: String) {
|
||||
Log.i(tag, msg)
|
||||
Log.i(tag, msg.fmt())
|
||||
}
|
||||
|
||||
override fun trace(msg: String) {
|
||||
Log.v(tag, msg)
|
||||
Log.v(tag, msg.fmt())
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package app.revanced.manager.compose.patcher.patch
|
|||
|
||||
import android.util.Log
|
||||
import app.revanced.manager.compose.patcher.PatchClass
|
||||
import app.revanced.manager.compose.util.tag
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
|
@ -20,7 +21,7 @@ class PatchBundle(private val loader: Iterable<PatchClass>, val integrations: Fi
|
|||
},
|
||||
integrations
|
||||
) {
|
||||
Log.d("revanced-manager", "Loaded patch bundle: $bundleJar")
|
||||
Log.d(tag, "Loaded patch bundle: $bundleJar")
|
||||
}
|
||||
|
||||
val patches = loadAllPatches().map(::PatchInfo)
|
||||
|
|
|
@ -8,8 +8,8 @@ import app.revanced.manager.compose.domain.repository.BundleRepository
|
|||
import app.revanced.manager.compose.patcher.Session
|
||||
import app.revanced.manager.compose.patcher.aapt.Aapt
|
||||
import app.revanced.manager.compose.util.PatchesSelection
|
||||
import app.revanced.manager.compose.util.tag
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.koin.core.component.KoinComponent
|
||||
|
@ -33,11 +33,13 @@ class PatcherWorker(context: Context, parameters: WorkerParameters) : CoroutineW
|
|||
|
||||
companion object {
|
||||
const val ARGS_KEY = "args"
|
||||
private const val logPrefix = "[Worker]:"
|
||||
private fun String.logFmt() = "$logPrefix $this"
|
||||
}
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
if (runAttemptCount > 0) {
|
||||
Log.d("revanced-worker", "Android requested retrying but retrying is disabled.")
|
||||
Log.d(tag, "Android requested retrying but retrying is disabled.".logFmt())
|
||||
return Result.failure()
|
||||
}
|
||||
val aaptPath =
|
||||
|
@ -73,11 +75,11 @@ class PatcherWorker(context: Context, parameters: WorkerParameters) : CoroutineW
|
|||
session.run(File(args.output), patchList, integrations)
|
||||
}
|
||||
|
||||
Log.i("revanced-worker", "Patching succeeded")
|
||||
Log.i(tag, "Patching succeeded".logFmt())
|
||||
progressManager.success()
|
||||
Result.success(progressManager.groupsToWorkData())
|
||||
} catch (e: Throwable) {
|
||||
Log.e("revanced-worker", "Got exception while patching", e)
|
||||
Log.e(tag, "Got exception while patching".logFmt(), e)
|
||||
progressManager.failure()
|
||||
Result.failure(progressManager.groupsToWorkData())
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package app.revanced.manager.compose.util.signing
|
||||
|
||||
import android.util.Log
|
||||
import app.revanced.manager.compose.util.tag
|
||||
import com.android.apksig.ApkSigner
|
||||
import org.bouncycastle.asn1.x500.X500Name
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
|
||||
|
@ -54,7 +55,7 @@ class Signer(
|
|||
|
||||
val ks = File(signingOptions.keyStoreFilePath)
|
||||
if (!ks.exists()) newKeystore(ks) else {
|
||||
Log.i("revanced-manager", "Found existing keystore: ${ks.name}")
|
||||
Log.i(tag, "Found existing keystore: ${ks.name}")
|
||||
}
|
||||
|
||||
val keyStore = KeyStore.getInstance("BKS", "BC")
|
||||
|
|
Loading…
Reference in a new issue