Hello. I recently upgraded from v3.0.5 to latest v...
# kotlin-logging
a
Hello. I recently upgraded from v3.0.5 to latest v7.0.7. I realized that KLogger no longer implements org.slf4j.Logger and methods like
Copy code
public fun info(msg: String?, vararg arguments: Any?): Unit
are deprecated with a suggestion to
Copy code
ReplaceWith("info { \"\$msg \$arguments\"}")
However, this can't honor formatting which was applied by previous underlying slf4j Logger e.g.
Copy code
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:
Copy code
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 🙏