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

Logger extra fields appended to end of log message instead of beginning #707

Closed
mccauleyp opened this issue Sep 28, 2021 · 4 comments
Closed
Assignees
Labels
feature-request feature request good first issue Good for newcomers help wanted Could use a second pair of eyes/hands

Comments

@mccauleyp
Copy link

Is your feature request related to a problem? Please describe.

I think it would be nice if by default, keys appended to the structure log messages with the extra=fields parameter appeared at the end of the log message rather than the beginning. That's actually the behavior shown in the sample CloudWatch logs in the documentation (https://awslabs.github.io/aws-lambda-powertools-python/latest/core/logger/), but I see the additional keys at the start of the log message when I use the extra argument. That makes it a bit harder to scroll through to find what I'm looking for in the logs.

Describe the solution you'd like

I think the default formatter could be updated for this to be the default.

Describe alternatives you've considered

I could create my own LambdaPowertoolsFormatter instance and order the keys explicitly but am hoping to avoid that and am wondering if this is the intended behavior already given how the sample logs look in the documentation.

Additional context

I'm using power tools version 1.20.2 and Python 3.8

Screen Shot 2021-09-28 at 12 52 56 PM

@mccauleyp mccauleyp added feature-request feature request triage Pending triage from maintainers labels Sep 28, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 28, 2021

Thanks for opening your first issue here! We'll come back to you as soon as we can.

@heitorlessa heitorlessa added good first issue Good for newcomers help wanted Could use a second pair of eyes/hands area/logger and removed triage Pending triage from maintainers labels Oct 1, 2021
@heitorlessa
Copy link
Contributor

Hey @mccauleyp thank you for raising this - it's definitely something we should fix it. It's a rather quick one so I'll work on that now to make it available for next week's release ;)

@heitorlessa
Copy link
Contributor

Done - should be available next week as we complete other critical areas before releasing 1.21 ;)

#722

Thanks again for flagging it!

@heitorlessa heitorlessa added the pending-release Fix or implementation already in dev waiting to be released label Oct 1, 2021
@heitorlessa heitorlessa self-assigned this Oct 1, 2021
@mccauleyp
Copy link
Author

mccauleyp commented Oct 4, 2021

Awesome, thanks! I'll close this ticket now and reopen if it seems like it's not working after I switch to 1.21.

@heitorlessa heitorlessa removed the pending-release Fix or implementation already in dev waiting to be released label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request good first issue Good for newcomers help wanted Could use a second pair of eyes/hands
Projects
None yet
Development

No branches or pull requests

2 participants