arkivanov / MVIKotlin

Extendable MVI framework for Kotlin Multiplatform with powerful debugging tools (logging and time travel)
https://arkivanov.github.io/MVIKotlin
Apache License 2.0
847 stars 32 forks source link

Logger interface should be a fun interface #82

Closed dalewking closed 1 year ago

dalewking commented 1 year ago

Logger interface has one method so it should be declared a fun interface so that it can be implemented using a lambda.

arkivanov commented 1 year ago

Makes sense, thanks.

arkivanov commented 1 year ago

Sorry, but I had to revert this change. Those interfaces are likely to get more methods in the future.

Consider the following kind of helpers for your needs:

fun Logger(log: (String) -> Unit): Logger =
    object : Logger {
        override fun log(text: String) {
            log.invoke(text)
        }
    }