mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Log app crash exceptions in dumped crash logs (#742)
This commit is contained in:
@@ -19,12 +19,13 @@ class CrashLogUtil(
|
||||
private val extensionManager: ExtensionManager = Injekt.get(),
|
||||
) {
|
||||
|
||||
suspend fun dumpLogs() = withNonCancellableContext {
|
||||
suspend fun dumpLogs(exception: Throwable? = null) = withNonCancellableContext {
|
||||
try {
|
||||
val file = context.createFileInCacheDir("mihon_crash_logs.txt")
|
||||
|
||||
file.appendText(getDebugInfo() + "\n\n")
|
||||
getExtensionsInfo()?.let { file.appendText("$it\n\n") }
|
||||
exception?.let { file.appendText("$it\n\n") }
|
||||
|
||||
Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}").waitFor()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user