Documentation of Android Timber integration is incorrect/misleading
Core or SDK?
Platform/SDK
Which part? Which one?
Android Timber Integration Documentation
Description
The part of the documentation about manual initialization and adding of SentryTimberIntegration is at least misleading. The code example looks like this:
import io.sentry.android.timber.SentryTimberIntegration
import timber.log.Timber
// import BuildConfig
SentryAndroid.init(this) { options ->
if (!BuildConfig.DEBUG) {
// default values:
// minEventLevel = ERROR
// minBreadcrumbLevel = INFO
options.addIntegration(
SentryTimberIntegration(
minEventLevel = SentryLevel.ERROR,
minBreadcrumbLevel = SentryLevel.INFO
)
)
} else {
Timber.plant(Timber.DebugTree())
}
}
From your code example I would expect that in the case of BuildConfg.DEBUG no SentryTimberTree is added to Timber. However, after a lot of trouble shooting I found in the source code, that a default SentryTimberTree is always added to Timber in the SentryAndroid.init() call as soon as Timber and the Sentry.Timber plugin is available in the classpath. Therefore, also all debug builds are logging to Sentry in this case.
Suggested Solution
Either this is a bug in your code, so that when auto-init is set to false, manually calling SentryAndroid.init() should not automatically add a Tree to Timber if you do no do that explicitly.
Or if this is intended behavior, at least your code example/documentation page should hint that behavior.
Assigning to @getsentry/support for routing, due by (sfo). ⏲️
Routing to @getsentry/product-owners-sdks-mobile for triage, due by (vie). ⏲️
hey @hirschbp, apologies for the confusion. We actually mention this behavior, but in the auto-installation section and not the manual one (the one you're referring to)
I think we should better support this case, so it's not only the documentation problem here, but the usage problem rather. We'll think of something and come up with a solution. Thanks for reporting!
How can I disable Timber Integration for DevDebug build variant, but enable Timber Integration for a specific build variant? Is it possible to do both programmatically?