Log Sentry crash events through MXLog

Mirror crashes into our own logs via Sentry's beforeSend hook so the full crash
log ships with rageshakes. Adds a SentryEvent extension to extract the formatted
crash log from the event.
This commit is contained in:
Stefan Ceriu
2026-06-15 14:30:18 +03:00
parent 434b3aab83
commit 0ce7a5ea13
3 changed files with 46 additions and 0 deletions
@@ -1019,6 +1019,14 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
bugReportService.lastCrashEventID = event.eventId.sentryIdString
}
// Mirror every crash into our own logs (which ship with rageshakes) before it's sent to Sentry.
options.beforeSend = { event in
if let crashLog = event.crashLog {
MXLog.error("Sentry crash event \(event.eventId.sentryIdString):\n\(crashLog)")
}
return event
}
// Any ongoing transactions will no longer be valid after calling SentrySDK.start so lets
// remove them and start over, otherwise the app will crash if finishTransaction is used.
analytics.signpost.resetTransactions()