-
Notifications
You must be signed in to change notification settings - Fork 421
Support custom log attributes via extra logger parameter #253
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
Comments
Hey @eoinsha - Great to hear from you, and thanks for opening this feature request. We're in PTO so I'll revisit in January - for now, I have one quick question for you: Logger allows an arbitrary object instead of string today: logger.info({ This will be encapsulated within the message key instead of being top-level keys: { Does this help or you prefer having a string to message plus extra keys as top level keys? If that helps, we should update the docs to make this more explicit. If not, I also think is fine having an extra key for this purpose for cases where you want to preserve the message |
Thanks @heitorlessa! I do have a preference for the |
+1 for this feature. Would make it easier to convice people at my org to use it :) |
it's be great if there would be no need for extra= but just send a kwargs |
Hey @eoinsha - PR created! Could you double check if that helps you moving forward? #257 @risenberg-cyberark we wouldn't be able to do it without cc Other folks who opened issues in the past, as this feature might help them out too @papi-tokei @ivamluz @patrickwerz @alvaropc |
This looks perfect, thanks @heitorlessa ! |
Thanks, @heitorlessa ! That covers that scenario I raised in the other PR I opened the other day. |
Merging it now, and it should be released by Friday along with other minor improvements ;) will circle back when 1.10.0 is available on PyPi this week |
@heitorlessa looking forward to the release. Thanks for your effort. |
This is perfect!
Thank you so much!
*Álvaro Ponce Cabrera.*
El mar, 12 ene 2021 a las 14:31, Heitor Lessa (<[email protected]>)
escribió:
… Hey @eoinsha <https://github.com/eoinsha> - PR created! Could you double
check if that helps you moving forward? #257
<#257>
@risenberg-cyberark <https://github.com/risenberg-cyberark> we wouldn't
be able to do it without extra as it'd break the logging protocol
<https://github.com/python/cpython/blob/11d13e83abedabba12b28773317f1a365113e7af/Lib/logging/__init__.py#L1585>
and make it slightly difficult for those moving in or outside Logger.
cc Other folks who opened issues in the past, as this feature might help
them out too @papi-tokei <https://github.com/papi-tokei> @ivamluz
<https://github.com/ivamluz> @patrickwerz <https://github.com/patrickwerz>
@alvaropc <https://github.com/alvaropc>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#253 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGANP567JD6ZUDJXDQHHXCDSZRFLVANCNFSM4VG3IFBQ>
.
|
hey everyone - This is now available on 1.10 on PyPi and on SAR :) Closing this now, and thank you for @eoinsha for raising it! |
Hi!
I am using the
aws-lambda-powertools-python
logger for a number of projects but also have existing deployments using structured JSON logging implemented with a custom logger. Our custom logger supports the Python loggingextra
parameter to supply custom attributes. It would be great if theaws-lambda-powertools-python
formatter supported custom attributes so we can take advantage of structured logging for additional attributes.Example
Current output:
Desired output:
This enables us to do effective log queries, filtering and stats using CloudWatch Logs Insights.
For reference:
python-json-logger
support custom attributes usingextra
- https://github.com/madzak/python-json-loggerextra
keyword argument to add custom attributes to theLogRecord
is covered here: https://docs.python.org/3/library/logging.htmlIs this something that you would consider supporting?
The text was updated successfully, but these errors were encountered: