Created
December 27, 2018 12:22
-
-
Save kalyaganov/1804ea4804e674d71c4da08350c7d173 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* A tree which logs important information for crash reporting. | |
*/ | |
private class CrashReportingTree : Timber.Tree() { | |
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { | |
if (priority == Log.VERBOSE || priority == Log.DEBUG) { | |
return | |
} | |
Crashlytics.log(priority, tag, message) | |
if (t != null) { | |
if (priority == Log.ERROR) { | |
Crashlytics.logException(t) | |
} else if (priority == Log.WARN) { | |
Crashlytics.logException(t) | |
} | |
} | |
} | |
} | |
Fabric.with(this, Crashlytics()) | |
Timber.plant(CrashReportingTree()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment