Search code examples
kotlinkotlin-logging

How to wrap an existing slf4j logger into a kotlin logger?


Given an existing slf4j logger, I would like to wrap it into an kotlin-logging logger.

The classes / methods to do that already exists in the library but are internal, so I can't call them: mu.internal.KLoggerFactory.wrapJLogger()

Is there another way to do it, which is accessible to users of the library?


Solution

  • It's possible to use the extension method: Logger.toKLogger() since 1.7.6. see this issue for more details: https://github.com/MicroUtils/kotlin-logging/issues/88