Skip to content

Timezone aware timestamp logging #381

Closed
@bml1g12

Description

@bml1g12

Describe the solution you'd like

I would like to be able to easily log in a timezone aware manner; a typical use case being to always log in UTC time, regardless of where the code is run. At present, the Powertools Logger() uses localtime for the timestamp field as under the hood it uses the asctime() method.

Describe alternatives you've considered
I raised this issue as a documentation query at first #379 and @heitorlessa kindly helped me find a workaround to this there using monkeypatching or overwritting the formatter.

It can be a new feature for Logger to have a flag to convert to UTC or a given offset, which I agree would be a useful feature as I imagine many users would desire the ability to ensure the timestamp is UTC. For example, this is actually a requirement if one wished to log strictly according to the ISO 8601 standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions