Android Toolkit: Timber for logging

Sometimes, is those little libraries that make a developer's work more pleasureful every day. Timber is one of those libraries, it makes Android logging simpler.

  • No more making up and carrying around tags any more. Timber sets the Log tag for you, with the class you're in.

  • Timber's log methods also have take a string, but they accept string format parameters after.

  • Logs are only printed on debug mode. You just need to add this on your application class:

public class ExampleApp extends Application {
  @Override public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
      Timber.plant(new DebugTree());
    }
  }
}