Closed
Description
Use case
Hi - we're beginning to use Powertools Logger as a canonical logger. By that I mean we append various key/values to the logger as the lambda executes and then flush them to stdout by calling a write method e.g myLogger.info('canonical');
Chatting with @am29d and @dreamorosi on Discord, it was confirmed there's no way to clear the keys that were added using appendKeys()
. This means that those keys remain present during the next warm lambda invocation.
Solution/User Experience
Providing a logger method such as clearState()
that clears down any user appended keys would solve the problem.
Alternative solutions
The only other solution in user land is to keep track of the appended keys and clear them down using removeKeys
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped