com.example.timber.ExampleApp Maven / Gradle / Ivy
package com.example.timber;
import android.app.Application;
import timber.log.Timber;
import static timber.log.Timber.DebugTree;
public class ExampleApp extends Application {
@Override public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new DebugTree());
} else {
Timber.plant(new CrashReportingTree());
}
}
/** A tree which logs important information for crash reporting. */
private static class CrashReportingTree extends Timber.HollowTree {
@Override public void i(String message, Object... args) {
// TODO e.g., Crashlytics.log(String.format(message, args));
}
@Override public void i(Throwable t, String message, Object... args) {
i(message, args); // Just add to the log.
}
@Override public void e(String message, Object... args) {
i("ERROR: " + message, args); // Just add to the log.
}
@Override public void e(Throwable t, String message, Object... args) {
e(message, args);
// TODO e.g., Crashlytics.logException(t);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy