Skip to content
Built upon Timber. Without performance penality.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
build.gradle Dependency update Nov 8, 2017
gradlew.bat Initial commit Feb 20, 2016
maven-push.gradle Fixed maven plugin Feb 20, 2016

Slimber - Android Logging with Kotlin

CI Status

Timber is a great library that makes logging very easy. However traditional logging like

if (BuildConfig.DEBUG) {
    String message = ...
    Log.d(TAG, message);

has one big advantage: The whole block will only be executed when you are in debug mode. If you pass anything to Timber, the String itself and the precalculations will be created. Even if you never planted a tree.

And this is where Slimber comes into play: It uses Kotlins inline capabilities so we can archieve the no-cost-effect because the whole block is executed only when there are trees planted. And remember: In Kotlin you can specify the last function in an arugment of a function outside the parentheses.

So you can do it like this:

d { "onCreate called with $expensiveToStringObject" }

There are also functions that take a throwable as the first paramter, so you can use them like

e(throwable) { "there was a severe error" }

Besides from that just use Timber for planting trees like you normally do



Add this to your root build.gradle

allprojects {
    repositories {
        maven { url "" }

And then this dependency to your project:

dependencies {
    compile 'com.github.PaulWoitaschek:Slimber:x.y.z'
You can’t perform that action at this time.