Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to make isLoggable() function public? #467

Open
mattinger opened this issue Apr 28, 2022 · 0 comments
Open

Is it possible to make isLoggable() function public? #467

mattinger opened this issue Apr 28, 2022 · 0 comments

Comments

@mattinger
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant