-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: convenience reset_state
method in Logger
#4134
Comments
Awesome, thank you for opening this @dreamorosi ! We'll work on this tomorrow |
Meanwhile we don't submit a PR for a top level method, this is possible today like this: logger.registered_formatter.clear_state() The top level method should delegate to formatter |
Hello @heitorlessa and @dreamorosi! I noticed in the issue aws-powertools/powertools-lambda-typescript#2337 that you two discussed how to resolve a "conceptual" bug with our current method names (persistent vs non-persistent) and their behavior. I see that some things are marked as deprecated to be removed in the next major release. As we're about to release Powertools for AWS Lambda (Python) v3, we have an opportunity to review this here. My idea is: 1 - Create a new method and call it 2 - Regarding the current I might be misunderstanding something regarding the TypeScript issue, and please correct me if this is the case. If not, and you agree with my proposal, I think we can proceed with implementing this change for Powertools for AWS Lambda (Python) v3. |
Hey Leo, I'm unsure on how to move forward with that feature and even more unsure whether to recommend that you skip it entirely in Python or not. The With Heitor we already hashed out the new API and wording (my second to last comment in the PR), but now there are some questions on how to actually implement it as fixing the implementation requires a different merging strategy for the attributes. I plan on fixing this later next week, or the week after once I'm done with the Madrid Summit. It's important to highlight here that this distinction between persistent and temporary attributes was added to TS as a deviation by the original implementer and not in response to customer demand, at least afaik. While there are valid use cases for this type of feature, I don't know that we have evidence of customers actually needing/using it, so the decision to add it to Python is up to you. |
Hello @dreamorosi! Thank you for your always valuable insights! I'm going to leave this here on hold until you make progress on the TypeScript PR and see if we can adopt the same in Python. If possible, it's good because we can start to reduce the differences in language implementations, if not I'll move forward and implement only the |
clear_state
method in Loggerreset_state
method in Logger
|
This is now released under 3.6.0 version! |
Use case
Note
This is a cross-language feature request that was originally brought up under aws-powertools/powertools-lambda-typescript#2337
As a customer who uses canonical logging - aka wide logging - I would like to be able to clear any key I might have appended to the Logger instance regardless of me using the default formatter or the decorator - both of which either expose a method along these lines or can be configured to automatically clear state.
Solution/User Experience
Alternative solutions
Acknowledgment
The text was updated successfully, but these errors were encountered: