Last active
September 2, 2015 10:56
-
-
Save adipascu/2e76e69f8541c2d83473 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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