Skip to content

Provide an annotation for auto-generating an extension property for a logger #139

@sschuberth

Description

@sschuberth

As discussed here 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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions