Replace printStackTrace with proper priority log (#722)

* Replace `printStackTrace` with proper priority log

* Fix
This commit is contained in:
FooIbar authored and GitHub committed 2024-02-12 14:40:45 +00:00
1 parent edaf0a4275
commit e36520faad
27 files changed
+99 -59

No files matched your search

+2
View File
@@ -239,6 +239,8 @@ dependencies {
implementation(libs.okio.jvm)
implementation(libs.logcat)
implementation(libs.diff)
implementation(libs.aboutlibraries.core)
@@ -20,7 +20,6 @@ import android.app.Application
import android.content.ComponentCallbacks2
import android.content.Context
import android.os.StrictMode
import android.util.Log
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.content.res.AppCompatResources
import androidx.collection.LruCache
@@ -68,6 +67,9 @@ import io.ktor.client.plugins.cookies.HttpCookies
import java.io.File
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.launch
import logcat.AndroidLogcatLogger
import logcat.LogPriority
import logcat.LogcatLogger
import moe.tarsin.coroutines.runSuspendCatching
import okhttp3.AsyncDns
import okhttp3.android.AndroidAsyncDns
@@ -104,6 +106,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
System.loadLibrary("ehviewer")
System.loadLibrary("ehviewer_rust")
ReadableTime.initialize(this)
LogcatLogger.install(AndroidLogcatLogger(LogPriority.VERBOSE))
lifecycleScope.launchIO {
launchIO {
EhTagDatabase
@@ -127,7 +130,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
}
}
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
launchIO {
@@ -143,7 +146,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
if (BuildConfig.DEBUG) {
StrictMode.enableDefaults()
Snapshot.registerApplyObserver { anies, _ ->
logcat(Log.VERBOSE) { anies.toString() }
logcat(LogPriority.VERBOSE) { anies.toString() }
}
}
}
@@ -152,12 +155,12 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
runCatching {
keepNoMediaFileStatus()
}.onFailure {
it.printStackTrace()
logcat(it)
}
runCatching {
clearTempDir()
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
@@ -10,6 +10,7 @@ import com.hippo.ehviewer.dailycheck.updateDailyCheckWork
import com.hippo.ehviewer.ui.keepNoMediaFileStatus
import com.hippo.ehviewer.util.isAtLeastS
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
@@ -68,7 +69,7 @@ fun updateWhenGallerySiteChanges() {
runCatching {
EhEngine.getUConfig()
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -79,7 +80,7 @@ fun updateWhenTagTranslationChanges() {
runCatching {
EhTagDatabase.update()
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -54,6 +54,7 @@ import com.hippo.ehviewer.dailycheck.today
import com.hippo.ehviewer.util.AppConfig
import com.hippo.ehviewer.util.ReadableTime
import com.hippo.ehviewer.util.StatusCodeException
import eu.kanade.tachiyomi.util.system.logcat
import io.ktor.client.request.forms.append
import io.ktor.client.statement.HttpStatement
import io.ktor.client.statement.bodyAsChannel
@@ -203,7 +204,7 @@ object EhEngine {
}.onFailure { throwable ->
// It may get redirected when accessing ex for the first time
if (url == EhUrl.URL_UCONFIG_EX) {
throwable.printStackTrace()
logcat(throwable)
ehRequest(url).fetchUsingAsText { check(U_CONFIG_TEXT in this) { "Unable to load config from $url!" } }
} else {
throw throwable
@@ -25,6 +25,7 @@ import com.hippo.ehviewer.util.AppConfig
import com.hippo.ehviewer.util.FileUtils
import com.hippo.ehviewer.util.StatusCodeException
import com.hippo.ehviewer.util.copyTo
import eu.kanade.tachiyomi.util.system.logcat
import io.ktor.client.HttpClient
import io.ktor.client.request.prepareGet
import io.ktor.client.statement.bodyAsChannel
@@ -213,7 +214,7 @@ object EhTagDatabase : CoroutineScope {
runSuspendCatching {
issueUpdateInMemoryData()
}.onFailure {
it.printStackTrace()
logcat(it)
}
updateInternal()
}
@@ -272,7 +273,7 @@ object EhTagDatabase : CoroutineScope {
// Read new EhTagDatabase
issueUpdateInMemoryData(dataFile)
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -17,6 +17,7 @@ package com.hippo.ehviewer.client.parser
import com.hippo.ehviewer.client.exception.InsufficientFundsException
import com.hippo.ehviewer.client.exception.NoHAtHClientException
import eu.kanade.tachiyomi.util.system.logcat
import org.jsoup.Jsoup
object ArchiveParser {
@@ -48,7 +49,7 @@ object ArchiveParser {
}.onSuccess {
archiveList.add(it)
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -42,6 +42,7 @@ import com.hippo.ehviewer.util.toFloatOrDefault
import com.hippo.ehviewer.util.toIntOrDefault
import com.hippo.ehviewer.util.trimAnd
import com.hippo.ehviewer.util.unescapeXml
import eu.kanade.tachiyomi.util.system.logcat
import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
@@ -298,7 +299,7 @@ object GalleryDetailParser {
if (group.size > 0) group else null
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
logcat(e)
null
}
}
@@ -313,7 +314,7 @@ object GalleryDetailParser {
parseTagGroups(tagGroups)
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
logcat(e)
emptyList()
}
}
@@ -323,7 +324,7 @@ object GalleryDetailParser {
trs.mapNotNull { parseTagGroup(it) }
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
logcat(e)
emptyList()
}
}
@@ -402,7 +403,7 @@ object GalleryDetailParser {
)
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
logcat(e)
null
}
}
@@ -434,7 +435,7 @@ object GalleryDetailParser {
GalleryCommentList(list, hasMore)
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
logcat(e)
EMPTY_GALLERY_COMMENT_LIST
}
}
@@ -19,6 +19,7 @@ import android.net.Uri
import android.os.Build
import com.hippo.ehviewer.client.EhUrl
import com.hippo.ehviewer.client.data.ListUrlBuilder
import eu.kanade.tachiyomi.util.system.logcat
import java.io.UnsupportedEncodingException
import java.net.MalformedURLException
import java.net.URL
@@ -77,7 +78,7 @@ object GalleryListUrlParser {
try {
URLDecoder.decode(uploader, StandardCharsets.UTF_8.displayName())
} catch (e: UnsupportedEncodingException) {
e.printStackTrace()
logcat(e)
return null
}
}
@@ -106,7 +107,7 @@ object GalleryListUrlParser {
try {
URLDecoder.decode(tag, StandardCharsets.UTF_8.displayName())
} catch (e: UnsupportedEncodingException) {
e.printStackTrace()
logcat(e)
return null
}
}
@@ -18,6 +18,7 @@
package com.hippo.ehviewer.client.parser
import com.hippo.ehviewer.util.ExceptionUtils
import eu.kanade.tachiyomi.util.system.logcat
import org.jsoup.Jsoup
object GalleryNotAvailableParser {
@@ -27,7 +28,7 @@ object GalleryNotAvailableParser {
e!!.child(0).html().replace("<br>", "\n")
}.getOrElse {
ExceptionUtils.throwIfFatal(it)
it.printStackTrace()
logcat(it)
null
}
}
@@ -24,6 +24,7 @@ import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.client.EhCookieStore
import com.hippo.ehviewer.client.EhEngine
import eu.kanade.tachiyomi.util.lang.withIOContext
import eu.kanade.tachiyomi.util.system.logcat
import java.time.Duration
import java.util.concurrent.TimeUnit
import kotlin.time.Duration.Companion.days
@@ -89,7 +90,7 @@ suspend fun checkDawn() = runCatching {
}
}
}.onFailure {
it.printStackTrace()
logcat(WORK_NAME, it)
}
@SuppressLint("MissingPermission")
@@ -118,6 +119,6 @@ fun showEventNotification(html: String) {
runCatching {
notificationManager.notify(1, msg.build())
}.onFailure {
it.printStackTrace()
logcat(WORK_NAME, it)
}
}
@@ -47,6 +47,7 @@ import com.hippo.unifile.UniFile
import com.hippo.unifile.asUniFile
import com.hippo.unifile.asUniFileOrNull
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.transform
@@ -455,7 +456,7 @@ object DownloadManager : OnSpiderListener {
suspend fun resetAllReadingProgress() = runCatching {
EhDB.clearProgressInfo()
}.onFailure { it.printStackTrace() }
}.onFailure { logcat(it) }
// Update in DB
// Update listener
@@ -31,6 +31,7 @@ import com.hippo.ehviewer.jni.releaseByteBuffer
import com.hippo.ehviewer.util.FileUtils
import com.hippo.unifile.UniFile
import com.hippo.unifile.displayPath
import eu.kanade.tachiyomi.util.system.logcat
import java.nio.ByteBuffer
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Job
@@ -160,7 +161,7 @@ class ArchivePageLoader(
extractToFd(index, it.fd)
}
}.getOrElse {
it.printStackTrace()
logcat(it)
false
}
}
@@ -53,6 +53,7 @@ import com.hippo.ehviewer.util.isAtLeastP
import com.hippo.ehviewer.util.isAtLeastQ
import com.hippo.ehviewer.util.isAtLeastU
import com.hippo.unifile.UniFile
import eu.kanade.tachiyomi.util.system.logcat
import java.nio.ByteBuffer
import splitties.init.appCtx
@@ -163,7 +164,7 @@ class Image private constructor(image: CoilImage, private val src: AutoCloseable
}
}.onFailure {
src.close()
it.printStackTrace()
logcat(it)
}.getOrNull()
}
@@ -38,6 +38,7 @@ import com.hippo.unifile.UniFile
import com.hippo.unifile.asUniFile
import com.hippo.unifile.openOutputStream
import eu.kanade.tachiyomi.util.lang.withNonCancellableContext
import eu.kanade.tachiyomi.util.system.logcat
import io.ktor.client.plugins.onDownload
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsChannel
@@ -89,7 +90,7 @@ class SpiderDen(val info: GalleryInfo) {
true
} ?: false
}.onFailure {
it.printStackTrace()
logcat(it)
}.getOrDefault(false)
}
@@ -187,7 +188,7 @@ class SpiderDen(val info: GalleryInfo) {
data.asUniFile() sendTo file
return true
}.onFailure {
it.printStackTrace()
logcat(it)
return false
}
}
@@ -197,7 +198,7 @@ class SpiderDen(val info: GalleryInfo) {
runCatching {
requireNotNull(findImageFile(uniFile, index)) sendTo file
}.onFailure {
it.printStackTrace()
logcat(it)
return false
}.onSuccess {
return true
@@ -276,7 +277,7 @@ class SpiderDen(val info: GalleryInfo) {
}
info.getComicInfo().write(it)
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -7,6 +7,7 @@ import com.hippo.ehviewer.legacy.readLegacySpiderInfo
import com.hippo.unifile.UniFile
import com.hippo.unifile.openInputStream
import com.hippo.unifile.openOutputStream
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.serialization.Serializable
import kotlinx.serialization.cbor.Cbor
import kotlinx.serialization.decodeFromByteArray
@@ -46,7 +47,7 @@ fun SpiderInfo.saveToCache() {
data.toFile().writeBytes(cbor.encodeToByteArray(this@saveToCache))
}
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
@@ -62,7 +63,7 @@ fun readFromCache(gid: Long): SpiderInfo? {
runCatching {
cbor.decodeFromByteArray<SpiderInfo>(data.toFile().readBytes())
}.onFailure {
it.printStackTrace()
logcat(it)
}.getOrNull()
}
}
@@ -41,6 +41,7 @@ import com.hippo.ehviewer.image.Image
import com.hippo.ehviewer.util.ExceptionUtils
import com.hippo.unifile.UniFile
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat
import java.util.concurrent.atomic.AtomicInteger
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@@ -244,7 +245,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
runCatching {
writeSpiderInfoToLocal()
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -352,7 +353,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
spiderInfo
}
}.onFailure {
it.printStackTrace()
logcat(it)
}.getOrNull()
}
@@ -370,7 +371,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
spiderInfo.pTokenMap[index]
}
}.getOrElse {
it.printStackTrace()
logcat(it)
null
}
}
@@ -400,7 +401,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
spiderInfo.pTokenMap[index]
}
}.getOrElse {
it.printStackTrace()
logcat(it)
null
}
}
@@ -133,6 +133,7 @@ import com.ramcosta.composedestinations.DestinationsNavHost
import com.ramcosta.composedestinations.rememberNavHostEngine
import com.ramcosta.composedestinations.utils.currentDestinationAsState
import eu.kanade.tachiyomi.util.lang.withIOContext
import eu.kanade.tachiyomi.util.system.logcat
import java.io.File
import java.io.FileOutputStream
import kotlinx.coroutines.channels.BufferOverflow
@@ -193,7 +194,7 @@ class MainActivity : EhActivity() {
FileOutputStream(temp).use { bitmap.compress(Bitmap.CompressFormat.JPEG, 90, it) }
temp
}.getOrElse {
it.printStackTrace()
logcat(it)
null
}
}
@@ -4,6 +4,7 @@ import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.client.EhCookieStore
import com.hippo.ehviewer.client.EhEngine
import com.hippo.ehviewer.client.EhUrl
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
@@ -15,7 +16,7 @@ suspend fun postLogin() = coroutineScope {
Settings.avatar = avatar
}
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
runCatching {
@@ -28,7 +29,7 @@ suspend fun postLogin() = coroutineScope {
EhEngine.getUConfig(EhUrl.URL_UCONFIG_E)
EhCookieStore.flush()
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
@@ -162,6 +162,7 @@ import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.launchUI
import eu.kanade.tachiyomi.util.lang.withIOContext
import eu.kanade.tachiyomi.util.lang.withUIContext
import eu.kanade.tachiyomi.util.system.logcat
import kotlin.math.roundToInt
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.launch
@@ -380,7 +381,7 @@ fun GalleryDetailScreen(args: GalleryDetailScreenArgs, navigator: DestinationsNa
is NoHAtHClientException -> activity.showTip(R.string.download_archive_failure_no_hath)
is EhException -> activity.showTip(ExceptionUtils.getReadableString(it))
else -> {
it.printStackTrace()
logcat(it)
activity.showTip(R.string.download_archive_failure)
}
}
@@ -631,7 +632,7 @@ fun GalleryDetailScreen(args: GalleryDetailScreenArgs, navigator: DestinationsNa
runSuspendCatching {
showTorrentDialog()
}.onFailure {
it.printStackTrace()
logcat(it)
activity.showTip(R.string.download_torrent_failure)
}
} else {
@@ -687,7 +688,7 @@ fun GalleryDetailScreen(args: GalleryDetailScreenArgs, navigator: DestinationsNa
}
ratingText = getAllRatingText(result.rating, result.ratingCount)
}.onFailure {
it.printStackTrace()
logcat(it)
activity.showTip(R.string.rate_failed)
}
}
@@ -1119,7 +1120,7 @@ fun GalleryDetailScreen(args: GalleryDetailScreenArgs, navigator: DestinationsNa
}
}
}.getOrElse {
it.printStackTrace()
logcat(it)
false
}
val msg = if (success) {
@@ -51,6 +51,7 @@ import com.hippo.ehviewer.util.ReadableTime
import com.hippo.ehviewer.util.isCronetAvailable
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import eu.kanade.tachiyomi.util.system.logcat
import java.io.File
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
@@ -123,7 +124,7 @@ fun AdvancedScreen(navigator: DestinationsNavigator) {
}
}.onFailure {
launchSnackBar(dumpLogError)
it.printStackTrace()
logcat(it)
}
}
}
@@ -212,7 +213,7 @@ fun AdvancedScreen(navigator: DestinationsNavigator) {
EhDB.exportDB(context, uri)
launchSnackBar(getString(R.string.settings_advanced_export_data_to, uri.toString()))
}.onFailure {
it.printStackTrace()
logcat(it)
launchSnackBar(exportFailed)
}
}
@@ -231,7 +232,7 @@ fun AdvancedScreen(navigator: DestinationsNavigator) {
EhDB.importDB(context, uri)
launchSnackBar(importSucceed)
}.onFailure {
it.printStackTrace()
logcat(it)
launchSnackBar(importFailed)
}
}
@@ -270,7 +271,7 @@ fun AdvancedScreen(navigator: DestinationsNavigator) {
}.onSuccess {
launchSnackBar(backupSucceed)
}.onFailure {
it.printStackTrace()
logcat(it)
launchSnackBar(backupFailed)
}
}
@@ -52,6 +52,7 @@ import com.hippo.unifile.displayPath
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import eu.kanade.tachiyomi.util.lang.launchNonCancellable
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import moe.tarsin.coroutines.runSuspendCatching
@@ -179,7 +180,7 @@ fun DownloadScreen(navigator: DestinationsNavigator) {
}
RestoreItem(dirname, gid, token)
}.onFailure {
it.printStackTrace()
logcat(it)
}.getOrNull()
}
runCatching {
@@ -187,7 +188,7 @@ fun DownloadScreen(navigator: DestinationsNavigator) {
runSuspendCatching {
fillGalleryListByApi(this, EhUrl.referer)
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
if (result.isEmpty()) {
@@ -203,7 +204,7 @@ fun DownloadScreen(navigator: DestinationsNavigator) {
launchSnackBar(RESTORE_COUNT_MSG(count + restoreDirCount))
}
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
WorkPreference(
@@ -227,7 +228,7 @@ fun DownloadScreen(navigator: DestinationsNavigator) {
val cnt = downloadLocation.listFiles().sumOf { clearFile(it).compareTo(false) }
launchSnackBar(FINAL_CLEAR_REDUNDANCY_MSG(cnt))
}.onFailure {
it.printStackTrace()
logcat(it)
}
}
}
@@ -3,6 +3,7 @@ package com.hippo.ehviewer.util
import android.os.Build
import android.os.Debug
import com.hippo.ehviewer.BuildConfig
import eu.kanade.tachiyomi.util.system.logcat
import java.io.File
import java.io.FileWriter
import java.io.OutputStreamWriter
@@ -75,7 +76,7 @@ object Crash {
fw.flush()
}
}.onFailure {
it.printStackTrace()
logcat(it)
file.delete()
}
if (t is OutOfMemoryError) {
@@ -16,6 +16,7 @@
package com.hippo.ehviewer.util
import com.hippo.ehviewer.R
import eu.kanade.tachiyomi.util.system.logcat
import java.io.IOException
import java.net.MalformedURLException
import java.net.ProtocolException
@@ -27,7 +28,7 @@ import splitties.init.appCtx
object ExceptionUtils {
fun getReadableString(e: Throwable): String {
e.printStackTrace()
logcat(e)
val cause = e.cause
return if (e is IOException && cause != null) {
getReadableStringInternal(cause)
@@ -16,6 +16,7 @@
package com.hippo.ehviewer.util
import android.os.Looper
import eu.kanade.tachiyomi.util.system.logcat
import java.io.BufferedReader
import java.io.FileReader
import java.util.regex.Pattern
@@ -59,7 +60,7 @@ object OSUtils {
}
}
}.onFailure {
it.printStackTrace()
logcat(it)
}
if (sTotalMem == Long.MIN_VALUE) {
sTotalMem = -1L
@@ -107,6 +107,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.withUIContext
import eu.kanade.tachiyomi.util.system.isNightMode
import eu.kanade.tachiyomi.util.system.logcat
import java.io.File
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.flow.MutableStateFlow
@@ -457,7 +458,7 @@ class ReaderActivity : EhActivity() {
try {
resolver.delete(imageUri, null, null)
} catch (e: Exception) {
e.printStackTrace()
logcat(e)
}
return@launchIO makeToast(R.string.error_cant_save_image)
} else if (isAtLeastQ) {
@@ -484,7 +485,7 @@ class ReaderActivity : EhActivity() {
makeToast(getString(R.string.image_saved, it.displayPath))
}
}.onFailure {
it.printStackTrace()
logcat(it)
makeToast(R.string.error_cant_find_activity)
}
}
@@ -1,11 +1,21 @@
package eu.kanade.tachiyomi.util.system
import android.util.Log
import logcat.LogPriority
import logcat.asLog
import logcat.logcat as logcatImpl
inline fun logcat(tag: String, priority: Int = Log.DEBUG, message: () -> String) {
Log.println(priority, tag, message())
inline fun logcat(tag: String, priority: LogPriority = LogPriority.DEBUG, message: () -> String) {
logcatImpl(tag, priority, message)
}
inline fun Any.logcat(priority: Int = Log.DEBUG, message: () -> String) {
Log.println(priority, javaClass.simpleName, message())
inline fun Any.logcat(priority: LogPriority = LogPriority.DEBUG, message: () -> String) {
logcatImpl(priority, message = message)
}
fun logcat(tag: String, throwable: Throwable) {
logcatImpl(tag, LogPriority.ERROR) { throwable.asLog() }
}
fun Any.logcat(throwable: Throwable) {
logcatImpl(LogPriority.ERROR) { throwable.asLog() }
}
+2
View File
@@ -96,6 +96,8 @@ kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
logcat = "com.squareup.logcat:logcat:0.1"
material = { module = "com.google.android.material:material", version.ref = "google-android-material" }
okhttp-android = { module = "com.squareup.okhttp3:okhttp-android" }