Skip to content

Instantly share code, notes, and snippets.

@defHLT
Created June 9, 2015 21:04
Show Gist options
  • Save defHLT/383b8e3020d6a5aa4f79 to your computer and use it in GitHub Desktop.
Save defHLT/383b8e3020d6a5aa4f79 to your computer and use it in GitHub Desktop.
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
} else {
Timber.plant(new CrashReportingTree());
}
....
private static class CrashReportingTree extends Timber.Tree {
@Override protected void log(int priority, String tag, String message, Throwable t) {
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);
if (t != null) {
Crashlytics.logException(t);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment