logging inner error cause to the log output

- also fixes log lines introducing blank lines due to a missing line height
This commit is contained in:
Adam Brown 2022-11-10 23:13:09 +00:00
parent d66f0c0ab9
commit 0020c29426
2 changed files with 15 additions and 2 deletions

View File

@ -10,6 +10,19 @@ class CrashTrackerLogger : ErrorTracker {
override fun track(throwable: Throwable, extra: String) { override fun track(throwable: Throwable, extra: String) {
Log.e("ST", throwable.message, throwable) Log.e("ST", throwable.message, throwable)
log(AppLogTag.ERROR_NON_FATAL, "${throwable.message ?: "N/A"} extra=$extra") log(AppLogTag.ERROR_NON_FATAL, "${throwable.message ?: "N/A"} extra=$extra")
throwable.findCauseMessage()?.let {
if (throwable.message != it) {
log(AppLogTag.ERROR_NON_FATAL, it)
}
}
}
}
private fun Throwable.findCauseMessage(): String? {
return when (val inner = this.cause) {
null -> this.message ?: ""
else -> inner.findCauseMessage()
} }
} }

View File

@ -107,10 +107,10 @@ private fun Events(selectedPageContent: SelectedState, onExit: () -> Unit, onSel
null -> "${it.time}: ${it.tag}: ${it.content}" null -> "${it.time}: ${it.tag}: ${it.content}"
else -> "${it.time}: ${it.content}" else -> "${it.time}: ${it.content}"
} }
Text( Text(
text = text, text = text,
modifier = Modifier.padding(horizontal = 4.dp), lineHeight = 14.sp,
modifier = Modifier.padding(horizontal = 4.dp).fillMaxWidth(),
fontSize = 10.sp, fontSize = 10.sp,
) )
} }