Proposal: SLF4J-like Logging Facade for Kotlin Multiplatform?
Hi everyone,
I’m wondering if there’s been any discussion around introducing a platform-agnostic logging facade for Kotlin Multiplatform, similar in spirit to what SLF4J is for the Java ecosystem.
The idea would be to define a common logging interface in commonMain that doesn’t enforce any particular implementation – allowing platform-specific bindings (e.g. Logcat on Android, NSLog on iOS, console.log on JS, etc.), or integrations with existing libraries like Kermit or Napier.
Such a facade could:
• Encourage interface-driven logging across shared and platform code
• Allow binding swap or mocking during testing
• Provide a consistent API without favoring a specific logging backend
• Reduce fragmentation across KMP libraries/projects using different solutions
To be clear, I’m not talking about bringing SLF4J into KMP, but rather asking:
Would it make sense to define a lightweight, SLF4J-style abstraction for logging in KMP?
Has something like this already been discussed or attempted?
Would like to hear your thoughts