Skip to content

Instantly share code, notes, and snippets.

@chenzhang2006
Last active February 28, 2022 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenzhang2006/70ecd5b6f8390ea957f2966fd634785c to your computer and use it in GitHub Desktop.
Save chenzhang2006/70ecd5b6f8390ea957f2966fd634785c to your computer and use it in GitHub Desktop.
Firebase Timber tree
class CrashlyticsReportTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (priority == Log.ERROR) { // only for error level
with(Firebase.crashlytics) {
// optional: setCustomKey("CUSTOME_TAG", any)
recordException(it)
}
}
}
}
// Configure in Application() when app starts
Timber.plant(CrashlyticsReportTree())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment