You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to diagnose a native crash and would like to collect additional information by attaching log files that are continuously written during app execution to the error event.
Since the relevant crash is in native code, it's only detected at the next app start. The attachment should only be included when the stack trace of the crashed thread contains frames from a specific library. The attachment is a zip file of multiple log files and can only be created just before adding the attachment.
I would preferably implement capturing the logs in Dart so that it works on all platforms. For that, there would need to be the ability to process native events in Dart.
I suspect that will not be possible any time soon, if ever. :) So, I've sketched out how to do it with the Sentry Swift SDK:
SentrySDK.start{ options in
options.beforeSend ={ event inletisCrashInCouchbaseLite= event.exceptions?.first?.stacktrace?.frames
.contains{ frame in frame.package?.contains("CouchbaseLite")??false}??falseif isCrashInCouchbaseLite {
// Can't figure out how to add an attachment to the event,
// so we capture a new event.
SentrySDK.capture(exception:NSException(name:NSExceptionName(event.eventId), reason:nil)){ scope in
// TODO: Zip logs
// TODO: Add file attachment to logs
}}return event
}}
What I was unable to figure out is:
how to add attachments in beforeSend in Swift and
how to set up the beforeSend callback without interfering with the Flutter Sentry plugin, which already calls SentrySDK.start.
Solution Brainstorm
No response
Are you willing to submit a PR?
None
The text was updated successfully, but these errors were encountered:
I suspect that will not be possible any time soon, if ever. :) So, I've sketched out how to do it with the Sentry Swift SDK:
You're correct, probably not, since if it crashes on iOS Native code or Android NDK code, the process just dies, it'd probably be possible to run the beforeSend on a restart on the Dart code, but as of now it's not planned, you can always do the beforeSend on the Native SDKs by following https://docs.sentry.io/platforms/flutter/native-init/
I'll discuss this internally, and open a new issue if needed.
For question 1., you can do scope.addAttachment(...).
SentrySDK.captureMessage(message: "my message", block: { scope in
scope.addAttachment(fileAttachment)
})
Problem Statement
I am trying to diagnose a native crash and would like to collect additional information by attaching log files that are continuously written during app execution to the error event.
Since the relevant crash is in native code, it's only detected at the next app start. The attachment should only be included when the stack trace of the crashed thread contains frames from a specific library. The attachment is a zip file of multiple log files and can only be created just before adding the attachment.
I would preferably implement capturing the logs in Dart so that it works on all platforms. For that, there would need to be the ability to process native events in Dart.
I suspect that will not be possible any time soon, if ever. :) So, I've sketched out how to do it with the Sentry Swift SDK:
What I was unable to figure out is:
beforeSend
in Swift andbeforeSend
callback without interfering with the Flutter Sentry plugin, which already callsSentrySDK.start
.Solution Brainstorm
No response
Are you willing to submit a PR?
None
The text was updated successfully, but these errors were encountered: