apache / logging-log4j-kotlin

A Kotlin-friendly interface to log against the Log4j API
https://logging.apache.org/log4j/kotlin
Apache License 2.0
46 stars 12 forks source link

Add an extension property for storing a cached logger #29

Closed jvz closed 1 year ago

jvz commented 1 year ago

Analogous to the extension function T.logger() which constructs a logger using the class of T, an extension property T.logger should be added for an alternative to using the Logging mixin. The general change is fairly simple:

inline val <reified T> T.logger: KotlinLogger
  get() = cachedLoggerOf(T::class.java)