Hello. I’m using the Sentry-cocoa sdk. I already integrated crash reporting and it works great. I would like to have application logs attached to crash reports.
I’m using Cocoalumberjack for logging, and it was very easy to integrate that with Crashlytics.
I found the Native SDK has a sentry_options_add_attachment method for that, but I can’t understand if the cocoa sdk gives access to the same functionality.
Thank you Bruno, I will use it for sure. I’m wondering how resource intensive is logging via breadcrumbs. Do you think I can direct all my app’s log to sentry this way (and of course have only the latest entries before a crash in Sentry web pages) without taxing the devices too much?
This depends on many factors. The main one is how much logging your generate and how do you use levels.
Breadcrumbs is just a ring buffer in the app. It’s bound to 100 items (configurable) so it throws away the oldest item to make space for new ones. There’s no I/O in the process of storing these, it shouldn’t have any noticeable performance impact but I suggest you measure things with a profiler to understand the impact in your app.
By default that integration doesn’t do anything with log entries with level lower than info. With info and warning messages it just stores in memory as I described above. And error entries will generate an event which means storing an event file to disk (to make sure it’s not lost if the app crashes) which is sent to Sentry on the background.
If there’s call to the logger with level error, the logging integration doesn’t send any events but the breadcrumbs it collected are included in case the app crashes which is already super useful.