-
Notifications
You must be signed in to change notification settings - Fork 402
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
Timezone aware timestamp logging #381
Comments
Thanks again for creating the feature request @bml1g12 - In the meantime, I've updated the docs with that fix until we decide on the best way to implement this for everyone ;) https://awslabs.github.io/aws-lambda-powertools-python/develop/core/logger/#setting-timestamp-to-utc cc @saragerion @pankajagrawal16 this is a great chance on using our brand new RFCs repo and make it public - I'm sure this will be asked at some point for Typescript and Java too |
@bml1g12 I completely agree with your proposal. Local time is calculated based on the context of the current machine and that might be different from the developer local time. The TypeScript Powertool is supporting ISO 8601 by default, and the timezone is always zero UTC offset. Developers can choose to customize the format if they want. |
This is now out in 1.15.0: #423.
|
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.
The text was updated successfully, but these errors were encountered: