import android.util.Log; import com.crashlytics.android.Crashlytics; import com.crashlytics.android.core.CrashlyticsCore; import timber.log.Timber; /** * Taken from https://gist.github.com/adi1133/2e76e69f8541c2d83473 */ public class CrashlyticsTree extends Timber.Tree { private final CrashlyticsCore crashlytics; public CrashlyticsTree(CrashlyticsCore crashlytics) { this.crashlytics = crashlytics; } @Override protected void log(int priority, String tag, String message, Throwable t) { if (priority > Log.DEBUG) { if (t != null) crashlytics.logException(t); if (tag == null) tag = Crashlytics.TAG; crashlytics.log(priority, tag, message); } } }