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): support use_datetime_directive for timestamps #920

Merged
merged 9 commits into from
Dec 31, 2021

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Dec 20, 2021

Issue #, if available: #905

Description of changes:

This adds a new argument datetime_fmt that provides more power over the current datefmt, by formatting using the datetime module rather than the time one. This is a separate argument to avoid changing behaviour for any existing users of datefmt.

Checklist

Breaking change checklist

RFC issue #:

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

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

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 20, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2021

Codecov Report

Merging #920 (e0c5751) into develop (be15e3c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #920   +/-   ##
========================================
  Coverage    99.96%   99.96%           
========================================
  Files          118      118           
  Lines         5281     5291   +10     
  Branches       606      608    +2     
========================================
+ Hits          5279     5289   +10     
  Partials         2        2           
Impacted Files Coverage Δ
aws_lambda_powertools/logging/logger.py 100.00% <ø> (ø)
aws_lambda_powertools/logging/formatter.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be15e3c...e0c5751. Read the comment docs.

@heitorlessa
Copy link
Contributor

thanks a lot @huonw - I need to finish two other PRs and then I'll get back to this. I think an extra string parameter could confuse customers... perhaps a flag parameter like use_datetime_format=True might be more explicit while datefmt remains true to its purpose

@huonw
Copy link
Contributor Author

huonw commented Dec 23, 2021

Sounds good!

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Dec 23, 2021
@heitorlessa
Copy link
Contributor

Docs PR finished. Will finish the new feature flags extension tomorrow (non-boolean values) then I get to this in the morning, and we release it ;-) o//!

If you have some good samples that we could add in the docs of some common date formats (e.g. ISO8601), that would be awesome!

@heitorlessa
Copy link
Contributor

All other PRs finished, looking into this now, taking the liberty to make some minor changes, docs, all in the same PR so we can merge and release it today o//!!!

…tools-python into feature/905-datetime

* 'develop' of https://github.com/awslabs/aws-lambda-powertools-python:
  feat(feature_flags): support beyond boolean values (JSON values) (aws-powertools#804)
  docs: consistency around admonitions and snippets (aws-powertools#919)
  chore(deps-dev): bump mypy from 0.920 to 0.930 (aws-powertools#925)
  fix(event-sources): handle dynamodb null type as none, not bool (aws-powertools#929)
  fix(apigateway): support @app.not_found() syntax & housekeeping (aws-powertools#926)
  docs: Added GraphQL Sample API to Examples section of README.md (aws-powertools#930)
  feat(idempotency): support dataclasses & pydantic models payloads (aws-powertools#908)
  feat(tracer): ignore tracing for certain hostname(s) or url(s) (aws-powertools#910)
  feat(event-sources): cache parsed json in data class (aws-powertools#909)
  fix(warning): future distutils deprecation (aws-powertools#921)
@heitorlessa heitorlessa added the feature New feature or functionality label Dec 31, 2021
@heitorlessa heitorlessa changed the title feat(logger): Add 'datetime_fmt' for log message timestamps using datetime feat(logger): Add 'use_datetime_directive' for log message timestamps using datetime Dec 31, 2021
@heitorlessa heitorlessa added this to the 1.24.0 milestone Dec 31, 2021
@heitorlessa heitorlessa changed the title feat(logger): Add 'use_datetime_directive' for log message timestamps using datetime feat(logger): support use_datetime_directive for timestamps Dec 31, 2021
@heitorlessa heitorlessa merged commit d304345 into aws-powertools:develop Dec 31, 2021
@huonw huonw deleted the feature/905-datetime branch January 3, 2022 23:24
@huonw
Copy link
Contributor Author

huonw commented Jan 3, 2022

Thanks for finishing this off (I was on leave). Your changes look great 👍

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/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants