Skip to content

Conversation

anafalcao
Copy link
Contributor

Issue number:
#4134
#4458

Summary

This PR introduces clear_state() method to the Logger class. This enhancement provides developers with more fine-grained control over the logger's state within a single Lambda function execution, allowing for more flexible and context-specific logging.

Changes

  • Add a new clear_state() method to the Logger class
  • For clear_state decorator, the 'danger message' contains more information with what it actually affects.

User experience

  1. clear_state method

image

  1. Add more information about clear_state decorator

image

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@anafalcao anafalcao requested a review from a team January 30, 2025 19:26
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation logger tests labels Jan 30, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 30, 2025
@github-actions github-actions bot added feature New feature or functionality and removed documentation Improvements or additions to documentation labels Jan 30, 2025
@anafalcao anafalcao self-assigned this Jan 30, 2025
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.24%. Comparing base (6971eb2) to head (6991e6b).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5956   +/-   ##
========================================
  Coverage    96.24%   96.24%           
========================================
  Files          234      234           
  Lines        11013    11016    +3     
  Branches       798      798           
========================================
+ Hits         10599    10602    +3     
  Misses         327      327           
  Partials        87       87           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leandrodamascena leandrodamascena changed the title feat(logger): add clear_state method to Logger feat(logger): add clear_state method Jan 30, 2025
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jan 30, 2025
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Jan 30, 2025
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @anafalcao! SUPER NICE work!! 🥇

I left some comments.

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jan 31, 2025
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Jan 31, 2025
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anafalcao! We just need to fix one thing and we're ready to merge! Thanks for responding to all the comments.

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jan 31, 2025
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Jan 31, 2025
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jan 31, 2025
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Jan 31, 2025
Copy link

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @anafalcao! Just wait until CI is complete and you can merge!
APPROVED! ✈️

@anafalcao anafalcao merged commit 9b33d29 into develop Jan 31, 2025
15 checks passed
@anafalcao anafalcao deleted the loggerstate branch January 31, 2025 22:22
sinofseven pushed a commit to sinofseven/powertools-lambda-python-my-extend that referenced this pull request Feb 13, 2025
* feat(logger): add clear_state method to Logger

* changes after feedback

* change reset default keys

---------

Co-authored-by: Leandro Damascena <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or functionality logger size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

Status: Coming soon

Development

Successfully merging this pull request may close these issues.

Docs: impact of clear_state=True when using Lambda Layers & Logger Feature request: convenience reset_state method in Logger

2 participants