powertools-lambda-python
powertools-lambda-python copied to clipboard
Allow logging of None type values on logging context via a config value
Use case
The built in logging formatter provides very good defaults, however is there a potential work around to avoid stripping logging context whose value is None
? This method call appears to remove any key value pairs on the log context whose value is None
:
https://github.com/aws-powertools/powertools-lambda-python/blob/e87b2b0758ef5beca0bdc901935ef3dc4c52a4f7/aws_lambda_powertools/logging/formatter.py#L181
This would allow log messages to show context that is set to None
which would be valuable in certain circumstances.
Solution/User Experience
Allow the passing in of a keyword argument that allows None
type values to be logged, as well as an environment variable that configures this behavior.
Alternative solutions
No response
Acknowledgment
- [X] This feature request meets Powertools for AWS Lambda (Python) Tenets
- [X] Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET