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

docs(logger): document enriching logs with logrecord attributes #1271

Merged

Conversation

kbakk
Copy link
Contributor

@kbakk kbakk commented Jul 1, 2022

Issue number: #1267

Summary

Document how users of the Logger can further enrich logs

Changes

Add additional FAQ question/answer.

User experience

n/a

Checklist

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

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.


View rendered docs/core/logger.md

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jul 1, 2022
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 1, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Jul 1, 2022

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

These look great!! One minor change to stay on brand with Powertools in capital, and one paragraph suggestion to ease reading.

docs/core/logger.md Outdated Show resolved Hide resolved
docs/core/logger.md Outdated Show resolved Hide resolved
docs/core/logger.md Outdated Show resolved Hide resolved
@kbakk
Copy link
Contributor Author

kbakk commented Jul 1, 2022

@kbakk
Copy link
Contributor Author

kbakk commented Jul 1, 2022

Ah, and one more thing, would you like a commit with changing **Headings like this** to #### Headings like this (so we can link to the FAQ questions)?

@heitorlessa
Copy link
Contributor

Yes to all of them!!!! Thank you

@kbakk kbakk force-pushed the docs/improve-logger-keys-usage branch from a261835 to fe34e7a Compare July 1, 2022 12:26
@kbakk
Copy link
Contributor Author

kbakk commented Jul 1, 2022

FAQ now has headers and links. 🙂

image

**What's the difference between `append_keys` and `extra`?**
### How can I add standard library logging attributes to a log record?

The Python standard library log records contains a [large set of atttributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools Logger log record by default.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nit, but.... "Powertools Logger" instead of `Powertools Logger"?

Suggested change
The Python standard library log records contains a [large set of atttributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools Logger log record by default.
The Python standard library log records contains a [large set of atttributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools `Logger` log record by default.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see why it'd make sense, but it'd be difficult to stay consistent over time - let's keep Powertools Logger. At least until we explore tools like Vale.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I think this is ready to merge then.


The Python standard library log records contains a [large set of atttributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools Logger log record by default.

You can include any of these logging attributes as key value arguments (`kwargs`) when instantiating `Logger` or `LambdaPowertoolsFormatter`.
Copy link
Contributor

Choose a reason for hiding this comment

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

For example, here Logger is more explicit in intent than Logger.

docs/core/logger.md Outdated Show resolved Hide resolved
@heitorlessa
Copy link
Contributor

Merging. Thank you so much again @kbakk. This will help a ton of customers coming from standard logging lib

@heitorlessa heitorlessa merged commit e8f9ad1 into aws-powertools:develop Jul 1, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Jul 1, 2022

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@kbakk kbakk deleted the docs/improve-logger-keys-usage branch July 1, 2022 15:49
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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants