Abhilash Mandaliya
07/18/2025, 6:23 AMpublic fun info(msg: String?, vararg arguments: Any?): Unit
are deprecated with a suggestion to
ReplaceWith("info { \"\$msg \$arguments\"}")
However, this can't honor formatting which was applied by previous underlying slf4j Logger e.g.
log.info("hello {}", "world")
How to deal with this? Our project is relying on this format at 100s of places.
Instead of deprecating those methods, could we have made them open and default implementation could have been what we suggest in the ReplaceWith. So that user can write a wrapper on top of KLogger or delegate the implementation with some trick like below:
override fun trace(format: String, vararg args: Any) {
if (this is Slf4jLogger<*>) {
underlyingLogger.trace(format, *args)
} else {
super.trace(format, *args)
}
}
Appreciate the response from community 🙏