Description
Use case
Following on from #1198, it would be fairly trivial to implement disabling a logger by extending the Logger
and overriding the shouldPrint function. Unfortunately it's marked as a private method and so can't be.
This ticket has been created to evaluate using the protected
method modifier instead of private
. There's pros and cons to doing that, but in my experience it is a quick option for improving extensibility, and provides escape hatches.
There are other solutions that can be better for extensibility, but they normally require a larger investment by the library creator, whereas using the protected
modifier is simple for the library creator, but puts the onus on the sub-class implementor to know exactly how that method is implemented and maintain any customization going forward.
Therefore another option is to selectively mark certain methods which are simple in nature and likely candidates for customization (such as shouldPrint
above).
Solution/User Experience
Use the protected
access modifier instead of private
either generally for all private methods, or certain methods where it's likely a user may want to customize its behaviour.
Alternative solutions
No response
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Python, Java
Metadata
Metadata
Assignees
Labels
Type
Projects
Status