mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 23:18:17 +03:00
Log app crash exceptions in dumped crash logs
Co-authored-by: FooIbar <118464521+FooIbar@users.noreply.github.com>
This commit is contained in:
parent
c04e039d36
commit
a10fc6dcb7
2 changed files with 3 additions and 2 deletions
|
@ -40,7 +40,7 @@ fun CrashScreen(
|
|||
acceptText = stringResource(MR.strings.pref_dump_crash_logs),
|
||||
onAcceptClick = {
|
||||
scope.launch {
|
||||
CrashLogUtil(context).dumpLogs()
|
||||
CrashLogUtil(context).dumpLogs(exception)
|
||||
}
|
||||
},
|
||||
rejectText = stringResource(MR.strings.crash_screen_restart_application),
|
||||
|
|
|
@ -22,13 +22,14 @@ class CrashLogUtil(
|
|||
private val animeExtensionManager: AnimeExtensionManager = Injekt.get(),
|
||||
) {
|
||||
|
||||
suspend fun dumpLogs() = withNonCancellableContext {
|
||||
suspend fun dumpLogs(exception: Throwable? = null) = withNonCancellableContext {
|
||||
try {
|
||||
val file = context.createFileInCacheDir("aniyomi_crash_logs.txt")
|
||||
|
||||
file.appendText(getDebugInfo() + "\n\n")
|
||||
getMangaExtensionsInfo()?.let { file.appendText("$it\n\n") }
|
||||
getAnimeExtensionsInfo()?.let { file.appendText("$it\n\n") }
|
||||
exception?.let { file.appendText("$it\n\n") }
|
||||
|
||||
Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}").waitFor()
|
||||
|
||||
|
|
Loading…
Reference in a new issue