-
Notifications
You must be signed in to change notification settings - Fork 506
Feature request: Add persistent keys option to Logger #6002
Copy link
Copy link
Open
Labels
feature-requestfeature requestfeature requestloggerneed-customer-feedbackRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decisionon-holdThis item is on-hold and will be revisited in the futureThis item is on-hold and will be revisited in the futurerevisit-in-3-monthsRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decision
Description
Activity
Metadata
Metadata
Assignees
Labels
feature-requestfeature requestfeature requestloggerneed-customer-feedbackRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decisionon-holdThis item is on-hold and will be revisited in the futureThis item is on-hold and will be revisited in the futurerevisit-in-3-monthsRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decision
Type
Projects
- StatusShow more project fieldsIdeas
Use case
Add custom keys to logs that should persist on every lambda execution and NOT be cleared when using clear_state.
This functionality already exists in the TypeScript version of powertools and can be useful for Python as well.
Solution/User Experience
Just like in the TypeScript version, add a new optional parameter to the Logger initializer. For example, the new option can be called persistent_keys.
This parameter could be a simple flat dict(or similar type?), and if not provided, default to an empty dict.
The value of this new parameter could either be added to self._default_log_keys(since what ever is in that already persists through a state clearing) or be maintained separately but treated just like self._default_log_keys.
Example init:
Example storing keys:
Alternative solutions
Acknowledgment