Update crashlytics

This commit is contained in:
Moez Bhatti
2020-12-30 22:00:35 -05:00
parent fe1967a876
commit c030d8ca50
3 changed files with 16 additions and 9 deletions
@@ -18,15 +18,25 @@
*/
package com.moez.QKSMS.common.util
import com.crashlytics.android.Crashlytics
import android.util.Log
import com.google.firebase.crashlytics.FirebaseCrashlytics
import timber.log.Timber
class CrashlyticsTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String?, throwable: Throwable?) {
Crashlytics.log(message)
val crashlytics = FirebaseCrashlytics.getInstance()
val priorityString = when (priority) {
Log.VERBOSE -> "V"
Log.DEBUG -> "D"
Log.INFO -> "I"
Log.WARN -> "W"
Log.ERROR -> "E"
else -> "WTF"
}
throwable?.run(Crashlytics::logException)
crashlytics.log("$priorityString/$tag: $message")
throwable?.run(crashlytics::recordException)
}
}