Imagine you moving your code from Java to Kotlin. How would you rewrite this code in Kotlin?

Technology CommunityCategory: KotlinImagine you moving your code from Java to Kotlin. How would you rewrite this code in Kotlin?
VietMX Staff asked 3 years ago
Problem
public class Foo {
    private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
}

Use Static-like approach:

class MyClass {
    companion object {
        val LOG = Logger.getLogger(MyClass::class.java.name) 
    }

    fun foo() {
        LOG.warning("Hello from MyClass")
    }
}