Skip to content

Instantly share code, notes, and snippets.

@adipascu
Last active September 2, 2015 10:56
Show Gist options
  • Save adipascu/2e76e69f8541c2d83473 to your computer and use it in GitHub Desktop.
Save adipascu/2e76e69f8541c2d83473 to your computer and use it in GitHub Desktop.
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment