Created
October 28, 2022 13:15
-
-
Save brunorsch/72a5aee63f8b258f94c2c0f3932b5d24 to your computer and use it in GitHub Desktop.
A similar approach to Lombok's `@Slf4j` "log" static prop in Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T> T.log(): Logger { | |
return LoggerFactory.getLogger(T::class.java) | |
} | |
// Usage: log().info("Something") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment