# logging in kotlin

# kotlin.logging

class FooWithLogging {
  companion object: KLogging()

  fun bar() {
    logger.info { "hello $name" }
  }

  fun logException(e: Exception) {
    logger.error(e) { "Error occured" }
  }
}

Using kotlin.logging (opens new window) framework

# Remarks

Related question: Idiomatic way of logging in Kotlin (opens new window)