Last active
February 28, 2022 14:54
-
-
Save chenzhang2006/70ecd5b6f8390ea957f2966fd634785c to your computer and use it in GitHub Desktop.
Firebase Timber tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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