Created
July 24, 2019 05:11
-
-
Save therealshabi/29aa89d44ec2f95899cf852834c689b4 to your computer and use it in GitHub Desktop.
Log Error Stacktrace into Crashlytics in addition to logging into the Logcat
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
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