Skip to content

Documentation of Android Timber integration is incorrect/misleading #7035

Open
@hirschbp

Description

@hirschbp

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.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions