JakeWharton/timber

Is it possible to make isLoggable() function public?

mattinger opened this issue · 0 comments

I'm trying to write a lazy wrapper around Timber so that it doesn't construct the final log string unless things are actually going to get logged.

class DefaultLazyTimberTree(private val delegate: Timber.Tree): LazyTimberTree {
    override fun d(message: () -> String?) {
        if (delegate.isLoggable(Log.DEBUG)) {
            delegate.d(message())
        }
    }
}

The issue here is that "isLoggable" is not a public function, so you can't inspect the tree/forest to decide if you need to call the lambda function or not.