Skip to content

Conversation

liampace
Copy link
Contributor

@liampace liampace commented Aug 19, 2025

This pull request is related to Issue #2280.
When this issue was initially presented it was mildly controversial because it would require the ability to directly set the logger's name. Fast forward to today and now the topic parameter is officially supported within the various logging annotations, thus making the main drawback null and void. I have provided an implementation for this feature as while the average developer may not need it, those working with micro-services, embedded development, and game programming to name a few would greatly benefit from it.

This feature works just like @Getter/@Setter's access parameter with one caveat:

  • The default value for access is AccessLevel.PRIVATE

Where is what the feature looks like:

package <org>.graphics;

@Log(access = AccessLevel.PROTECTED, topic="RenderPipeline")
public abstract class Graphics2D {
    public static class Graphics2DFactory {
        public Graphics2D create(String classname) {
            // create and return instance
        }
   }
    // ... draw/render methods 
}
package <org>.graphics.opengl;
import static <org>.graphics.Graphics2D.log;

// This class can now use the provided logger from Graphics2D
class OpenGLGraphics2DImpl extends Graphics2D {
    // implement methods from Graphics2D
}
package <org>.graphics.vulkan;
import static <org>.graphics.Graphics2D.log;

// This class can now use the provided logger from Graphics2D
class VulkanGraphics2DImpl extends Graphics2D {
    // implement methods from Graphics2D
}

@rzwitserloot
Copy link
Collaborator

access is not misleading, I doubt anybody is going to misunderstand what it would do. I dislike introducing lombok features that have no purpose other than to enable bad code, but,

those working with micro-services, embedded development, and game programming to name a few would greatly benefit from it.

That's all stuff I don't have much experience with. The damage is minimal because it's hard to misunderstand what access would do, and I'm not particularly convinced about the veracity of 'non-private loggers bad' .

Accepted. I used a more logical git workflow to my sensibilities (rebase it on master, then merge and push it), but evidently github no longer understands this. Your commits are in as normal, I just moved them around in history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants