apache / apache/logging-log4j-kotlin
Provide an annotation for auto-generating an extension property for a logger
- Dominant language
- Kotlin
- Stars
- 53
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
As discussed [here](https://github.com/apache/logging-log4j-kotlin/issues/136#issuecomment-3352105291) with @rocketraman, another possibility to solve both the "auto-pollution" of any class with a `logger` property and the performance hit introduced by getting a cached logger instance could be to provide a KSP-based compiler plugin that auto-generates code for annotated classes.
It could work a bit similar to projects like [this](https://github.com/darkxanter/kdatamapper) which auto-generate extension functions for annotated classes. A difference would be that instead of an extension *function* a *property* is generated. As the property is generated at compile-time, it can hard-code the class / logger name, avoiding the need to look up a cached logger for a specific class.
To avoid each instance of a class to get its own logger property, probably some more logic needs to be added to statically add the property to a (dummy) companion object instead.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the discussion in issue 136 and compare the KSP-based approach with the linked kdatamapper project. Define how annotated classes would receive a generated logger extension property, including whether it belongs on a dummy companion object; done means the design and generated API are agreed and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100