Automattic / Automattic-Tracks-iOS

Client library for tracking user events for later analysis
GNU General Public License v2.0
43 stars 12 forks source link

Quickfix: Disable Sentry `debug` mode and set logging level to `.error` #227

Closed mokagio closed 2 years ago

mokagio commented 2 years ago

Logging level became .debug by default in Sentry 7.x, which could result in too much noise in the Xcode console.

Sentry has six logging levels:

This is a quickfix proposal to address the immediate issue of overwhelming logs in Tracks version starting from 0.12.1-beta.2.

A better long term approach would be to define a Tracks-scoped logging level type and add it to CrashLoggingDataProvider to allow clients to configure it.

I noticed we already have an EventLoggingErrorType (.fatal, .debug). That could be a starting point, but is not as refined as Sentry's. It also sets the expectation that it should be used only for errors.

Another option might be to introduce swift-log as a dependency (which in itself has drawbacks) and use its Logger.Level type.

That's all to say, I don't want to rush into picking an option which, if we wanted to move away from, would break all the clients. Because of that, I think we should merge this quick fix first.

If you agree with my approach, I'll add a version bump commit before merging.

mokagio commented 2 years ago

For the record: I run WooCommerce iOS pointing Tracks to this branch and clicked around a bit in the Simulator. I couldn't find any Sentry log, while @jaclync said they seemed to appear for every network request.

It's possible I missed something during my testing, but I'll assume everything was correct and do not require additional verification before shipping a new beta.

If I made a mistake, it will be apparent when the Woo iOS devs start working with the app using the version including these changes.