Android Open Source - timber Example App






From Project

Back to project page timber.

License

The source code is released under:

Apache License

If you think the Android project timber listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.timber;
//from  w w w .ja  v  a 2 s. c o  m
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);
    }
  }
}




Java Source Code List

com.example.timber.ExampleApp.java
com.example.timber.ui.DemoActivity.java
timber.lint.CallToLogNotTimberDetector.java
timber.lint.IssueRegistry.java
timber.log.Timber.java