Skip to content

Instantly share code, notes, and snippets.

@cp-hardik-p
Last active September 30, 2022 10:44
Show Gist options
  • Select an option

  • Save cp-hardik-p/8e2839b78e2344a1730cedc08f40b83b to your computer and use it in GitHub Desktop.

Select an option

Save cp-hardik-p/8e2839b78e2344a1730cedc08f40b83b to your computer and use it in GitHub Desktop.
class CrashlyticsLogTree(private val firebaseCrashlytics: FirebaseCrashlytics) : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (t != null) {
firebaseCrashlytics.recordException(CrashlyticsNonFatalError("$tag : $message", t))
} else {
firebaseCrashlytics.log("$priority/$tag: $message")
}
}
class CrashlyticsNonFatalError constructor(message: String, cause: Throwable) :
RuntimeException(message, cause)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment