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 use_rfc3339 and auto-complete formatter opts in Logger #1662

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Oct 27, 2022

Issue number: #946

Summary

This makes it easier to use a compatible date format with RFC3339 and ISO8601: 2022-10-27T16:27:43.738+02:00

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

You can now simply use use_rfc3339 flag to enable it

logger = Logger(service=service_name, stream=stdout, use_rfc3339=True)

This PR also raised a suboptimal UX we had on propagating LambdaPowertoolsFormatter options in Logger as kwargs. When implementing this feature, it made it difficult to remember the entire param. For this reason, this PR exposes all of them within Logger constructor, so that: Logger(utc=, ...) autocompletes.

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.

@heitorlessa heitorlessa requested a review from a team as a code owner October 27, 2022 17:27
@heitorlessa heitorlessa requested review from rubenfonseca and removed request for a team October 27, 2022 17:27
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 27, 2022
@heitorlessa heitorlessa marked this pull request as draft October 27, 2022 17:27
@github-actions github-actions bot added the feature New feature or functionality label Oct 27, 2022
@heitorlessa heitorlessa marked this pull request as ready for review October 28, 2022 08:59
@heitorlessa heitorlessa requested review from leandrodamascena and removed request for rubenfonseca October 28, 2022 09:00
@heitorlessa
Copy link
Contributor Author

@leandrodamascena need your review as this must be included in today's release

@heitorlessa heitorlessa linked an issue Oct 28, 2022 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2022

Codecov Report

Base: 99.35% // Head: 99.35% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (fdd9261) compared to base (87de70c).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1662   +/-   ##
========================================
  Coverage    99.35%   99.35%           
========================================
  Files          128      128           
  Lines         5908     5917    +9     
  Branches       373      375    +2     
========================================
+ Hits          5870     5879    +9     
  Misses          18       18           
  Partials        20       20           
Impacted Files Coverage Δ
aws_lambda_powertools/logging/formatter.py 100.00% <100.00%> (ø)
aws_lambda_powertools/logging/logger.py 100.00% <100.00%> (ø)
...da_powertools/utilities/idempotency/idempotency.py 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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 @heitorlessa! I tested it locally and it's working as expected!

I just made a comment, but if you don't agree with that I think this PR is read to merge.

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 28, 2022
@heitorlessa
Copy link
Contributor Author

Addressed your feedback and shorten to use_rfc3339. I'll work on docs now to make this more visible.

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Oct 28, 2022
@heitorlessa
Copy link
Contributor Author

Docs done - @leandrodamascena if you approve, feel free to merge.

image

image

@heitorlessa heitorlessa changed the title feat(logger): add use_rfc3339_iso8601 option feat(logger): add use_rfc3339 option and auto-complete formatter options in Logger Oct 28, 2022
@heitorlessa heitorlessa changed the title feat(logger): add use_rfc3339 option and auto-complete formatter options in Logger feat(logger): add use_rfc3339 option and auto-complete formatter opts in Logger Oct 28, 2022
@heitorlessa heitorlessa changed the title feat(logger): add use_rfc3339 option and auto-complete formatter opts in Logger feat(logger): add use_rfc3339 option, auto-complete formatter opts in Logger Oct 28, 2022
@heitorlessa heitorlessa changed the title feat(logger): add use_rfc3339 option, auto-complete formatter opts in Logger feat(logger): add use_rfc3339 and auto-complete formatter opts in Logger Oct 28, 2022
@leandrodamascena
Copy link
Contributor

Docs done - @leandrodamascena if you approve, feel free to merge.

Amazing @heitorlessa!

@leandrodamascena leandrodamascena merged commit 8939535 into aws-powertools:develop Oct 28, 2022
@jplock
Copy link

jplock commented Oct 31, 2022

Question on the usage of this, if I set use_rfc3339=True in the main Logger, and then reference another logger in another file with Logger(child=True), do I also have to set use_rfc3339=True in the child loggers?

@heitorlessa
Copy link
Contributor Author

heitorlessa commented Oct 31, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or functionality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation on using custom date format for logging
4 participants