Reorder crash logs

to remove the starting new line at each log
This commit is contained in:
Jays2Kings 2022-04-19 22:14:27 -04:00
parent 29621c755a
commit 313120307b

View file

@ -23,8 +23,8 @@ class CrashLogUtil(private val context: Context) {
fun dumpLogs() { fun dumpLogs() {
try { try {
val file = context.createFileInCacheDir("tachiyomi_crash_logs.txt") val file = context.createFileInCacheDir("tachiyomi_crash_logs.txt")
Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}")
file.appendText(getDebugInfo()) file.appendText(getDebugInfo())
Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}")
showNotification(file.getUriCompat(context)) showNotification(file.getUriCompat(context))
} catch (e: IOException) { } catch (e: IOException) {
@ -33,7 +33,6 @@ class CrashLogUtil(private val context: Context) {
} }
fun getDebugInfo(): String { fun getDebugInfo(): String {
return """ return """
App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE}, ${BuildConfig.BUILD_TIME}) App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE}, ${BuildConfig.BUILD_TIME})
Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT}) Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT})
Android build ID: ${Build.DISPLAY} Android build ID: ${Build.DISPLAY}
@ -42,6 +41,7 @@ class CrashLogUtil(private val context: Context) {
Device name: ${Build.DEVICE} Device name: ${Build.DEVICE}
Device model: ${Build.MODEL} Device model: ${Build.MODEL}
Device product name: ${Build.PRODUCT} Device product name: ${Build.PRODUCT}
""".trimIndent() """.trimIndent()
} }
private fun showNotification(uri: Uri) { private fun showNotification(uri: Uri) {