Skip to content

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

Closed
@mccauleyp

Description

@mccauleyp

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions