Created
May 12, 2016 16:46
-
-
Save jonfinerty/3e24867df66cd6e14c5937a72ed6d50a to your computer and use it in GitHub Desktop.
Report Android Exceptions - Crashlytics Tree for Timber
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
import android.util.Log; | |
import com.crashlytics.android.Crashlytics; | |
import timber.log.Timber; | |
public class CrashlyticsTree extends Timber.Tree { | |
@Override | |
protected boolean isLoggable(int priority) { | |
return priority >= Log.ERROR; | |
} | |
@Override | |
protected void log(int priority, String tag, String message, Throwable throwable) { | |
Crashlytics.log(priority, tag, message); | |
if (throwable != null) { | |
Crashlytics.logException(throwable); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isLoggable(int priority)
is now deprecated.isLoggable(String tag, int priority)
should be used instead.