Skip to content

Instantly share code, notes, and snippets.

@jonfinerty
Created May 12, 2016 16:46
Show Gist options
  • Save jonfinerty/3e24867df66cd6e14c5937a72ed6d50a to your computer and use it in GitHub Desktop.
Save jonfinerty/3e24867df66cd6e14c5937a72ed6d50a to your computer and use it in GitHub Desktop.
Report Android Exceptions - Crashlytics Tree for Timber
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);
}
}
}
@davidmigloz
Copy link

isLoggable(int priority) is now deprecated. isLoggable(String tag, int priority) should be used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment