Skip to content

Instantly share code, notes, and snippets.

@therealshabi
Created July 24, 2019 05:11
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 therealshabi/29aa89d44ec2f95899cf852834c689b4 to your computer and use it in GitHub Desktop.
Save therealshabi/29aa89d44ec2f95899cf852834c689b4 to your computer and use it in GitHub Desktop.
Log Error Stacktrace into Crashlytics in addition to logging into the Logcat
package com.example.shahbaz
import android.util.Log
import com.crashlytics.android.Crashlytics
import timber.log.Timber
class CrashlyticsTree : Timber.DebugTree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
super.log(priority, tag, message, t)
if (priority != Log.ERROR) return
Crashlytics.logException(t ?: Throwable(message))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment