Skip to content
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

feat(logger): add clear_state method #5956

Merged
merged 4 commits into from
Jan 31, 2025
Merged

feat(logger): add clear_state method #5956

merged 4 commits into from
Jan 31, 2025

Conversation

anafalcao
Copy link
Collaborator

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 as a code owner 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.

aws_lambda_powertools/logging/logger.py Show resolved Hide resolved
aws_lambda_powertools/logging/logger.py Outdated Show resolved Hide resolved
docs/core/logger.md Show resolved Hide resolved
docs/core/logger.md Outdated Show resolved Hide resolved
docs/core/logger.md Outdated Show resolved Hide resolved
@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
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
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
2 participants