-
-
Save davinctor/ecac41b55be68a66ac3520b6676a0abc to your computer and use it in GitHub Desktop.
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; | |
/** | |
* A logging implementation which reports 'info', 'warning', and 'error' logs to Crashlytics. | |
*/ | |
public final class CrashlyticsTree extends Timber.Tree { | |
@Override | |
protected boolean isLoggable(String tag, int priority) { | |
return priority >= Log.INFO; | |
} | |
@Override | |
protected void log(int priority, String tag, String message, Throwable t) { | |
Crashlytics.log(priority, tag, message); | |
if (t != null && priority == Log.ERROR) { | |
Crashlytics.logException(t); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment