Created
January 18, 2017 13:08
-
-
Save anonymous/5e8088dc9acd165df75bd09c0b2e2f8b 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