Slide 33
Slide 33 text
Crashlytics
class CrashlyticsTree(val applicationTag: String) : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
val crashlyticsTag = tag ?: applicationTag
// Log the message to Crashlytics, so we can see it in crash reports
Crashlytics.log(priority, crashlyticsTag, message);
// Log the exception in Crashlytics if we have one.
if (t != null) {
Crashlytics.logException(t)
}
// If this is an error or a warning, log it as a exception so we see it in Crashlytics.
if (priority > Log.WARN) {
Crashlytics.logException(Throwable(message))
}
}
}