class FooWithLogging { companion object: KLogging() fun bar() { logger.info { "hello $name" } } fun logException(e: Exception) { logger.error(e) { "Error occured" } } }
Using kotlin.logging framework