Avatar ·

Idiomatic way of logging in Kotlin: how to do it correctly and without boilerplate?

Hello, colleagues! I'm new to Kotlin (switched from Java) and can't figure out how to properly organize logging in a project. In Java, I was used to writing something like: ```kotlin private static final Logger log = LoggerFactory.getLogger(MyClass.class); ``` And then using `log.info(...)`. In Kotlin, this looks cumbersome and ugly: you have to specify `javaClass` or `this::class.java` every time. It results in a lot of boilerplate code. I tried writing like this: ```kotlin class MyService { private val logger = LoggerFactory.getLogger(MyService::class.java) fun doSomething() { logger.info("Doing something") } } ``` But this still repeats in every class. I've heard about kotlin-logging and extension properties, but I don't fully understand how it works and