JakeWharton / JakeWharton/timber
Is it possible to make isLoggable() function public?
- Dominant language
- Kotlin
- Stars
- 10.8k
- Forks
- 994
- Avg merge
- 17h 16m
- Merged PRs (30d)
- 17
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting Timber.Tree and its isLoggable function, then trace how the delegate and forest logging methods use it. Done means callers can publicly check whether a log level is enabled before evaluating a lazy message, with the existing Timber API behavior preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100