Hey team! ๐
I just released my first open-source Kotlin library and wanted to share it with you all!
kotlin-logging-extensions - Brings Lombok-style automatic logger generation to Kotlin using KSP ๐ง
The Problem: Coming from Java, I really missed
@Slf4j
annotationโs simplicity. In Kotlin, you either put loggers at the top-level (breaking โone class per fileโ) or declare them in every single class (lots of boilerplate).
The Solution: Just use
<http://log.info|log.info> { }
directly in any class - no declarations needed!
class UserService {
fun createUser() {
<http://log.info|log.info> { "Creating user" } // :sparkles: Works automatically!
}
}
How it works: Uses Kotlin Symbol Processing (KSP) to generate logger extensions at compile-time. Zero runtime overhead, integrates with kotlin-logging, and works with any package depth.
๐
GitHub:
https://github.com/doljae/kotlin-logging-extensions
Still early stage (v0.0.1) but itโs already working well in my projects. Would love to hear your thoughts or feedback if anyone tries it out!
#Kotlin #KSP #Logging #OpenSource