LighthouseGames / KmLogging

Kotlin multiplatform logging. High performance, composable and simple to use.
Apache License 2.0
84 stars 13 forks source link

Is the logger thread-safe? #16

Closed MinmoTech closed 7 months ago

MinmoTech commented 1 year ago

I'm wondering if with the usage in the readme access to the logger would be thread-safe?

class MyClass {
    fun easyPeasy() {
        log.i { "use traditional Android short function name" }
    }

    fun easyPeasyLemonSqueesy() {
        log.info { "use longer more explicit function name" }
    }

    companion object {
        val log = logging()
    }
}

In this case, if there were 2 instances of MyClass and both access log at the same time could there be a race condition?

Either way would be fine, it would just be nice if this would be made clear from the readme :slightly_smiling_face:

ellsworthrw commented 7 months ago

Yes, the logger is thread safe