mirror of https://github.com/tasks/tasks
Add Facebook Stetho
parent
f11c01507f
commit
e4eee25611
@ -0,0 +1,28 @@
|
|||||||
|
package org.tasks;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.facebook.stetho.Stetho;
|
||||||
|
import com.squareup.leakcanary.LeakCanary;
|
||||||
|
|
||||||
|
import org.tasks.injection.ForApplication;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
public class BuildSetup {
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public BuildSetup(@ForApplication Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
Timber.plant(new Timber.DebugTree());
|
||||||
|
Stetho.initializeWithDefaults(context);
|
||||||
|
LeakCanary.install((Application) context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package org.tasks;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
public class BuildSetup {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public BuildSetup() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
Timber.plant(new ErrorReportingTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ErrorReportingTree extends Timber.Tree {
|
||||||
|
@Override
|
||||||
|
protected void log(int priority, String tag, String message, Throwable t) {
|
||||||
|
if (priority < Log.WARN) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (priority == Log.ERROR) {
|
||||||
|
if (t == null) {
|
||||||
|
Log.e(tag, message);
|
||||||
|
} else {
|
||||||
|
Log.e(tag, message, t);
|
||||||
|
}
|
||||||
|
} else if(priority == Log.WARN) {
|
||||||
|
if (t == null) {
|
||||||
|
Log.w(tag, message);
|
||||||
|
} else {
|
||||||
|
Log.w(tag, message, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue