Integration with Timber
Timber Introduction
Timber is a logger with a small, extensible API which provides utility on top of Android's normal Log class. While Timber itself does not support cloud-based log storage, it relies on external implementations of a "tree" system to enable this functionality. Shipbook offers a solution by providing visibility into all your app's issues and logs remotely. Integrating Shipbook with Timber creates a comprehensive logging solution.
Integrating with Timber
Just add the following code and it will work out of the box with timber.
- Kotlin
- Java
ShipBook.addWrapperClass(Timber::class.java.name)
Timber.plant(object : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
Log.message(tag, message, priority, t)
}
init {
ShipBook.addWrapperClass(this.javaClass.name)
}
})
ShipBook.addWrapperClass(Timber.class.getName());
Timber.plant(new Timber.Tree() {
{
ShipBook.addWrapperClass(this.getClass().getName());
}
@Override
protected void log(int priority, @Nullable String tag, @NotNull String message, @Nullable Throwable t) {
Log.message(tag, message, priority, t);
}
});
Now you can use Timber as you normally would and all logs will be sent to Shipbook.