timberkt
timberkt copied to clipboard
Add @JvmOverloads to support optional arguments in Java
For example replace:
@JvmStatic inline fun i(t: Throwable? = null, message: () -> String) = log { Timber.i(t, message()) }
with
@JvmOverloads @JvmStatic inline fun i(t: Throwable? = null, message: () -> String) = log { Timber.i(t, message()) }
Currently, we have to pass null explicitly in Java
Interesting. This is doable, but I assumed that people would use the regular Timber methods directly in Java code. What's your use case for using the extensions outside of Kotlin?
The main disadvantage of using the extension from Java is that log tag will be incorrect, since it relies on the extensions being inlined.