-
Notifications
You must be signed in to change notification settings - Fork 433
fix(logger): force Logger to use local timezone when UTC flag is not set #3168
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f9ff57b
fix simple yet troublesome error
roger-zhangg 3238be2
fix timezone, add doc, add e2e test
roger-zhangg 331123b
fix line number
roger-zhangg e0b9bd5
Merge branch 'develop' into tz_fix
leandrodamascena cb5f25a
update tz in to utc, address leandro comment
roger-zhangg 8df8eb7
Merge branch 'tz_fix' of github.com:roger-zhangg/aws-lambda-powertool…
roger-zhangg a4f82ec
fix poetry
roger-zhangg ba76573
Small changes
leandrodamascena e089bcf
Merge remote-tracking branch 'upstream/develop' into tz_fix
leandrodamascena bf94279
Reverting test
leandrodamascena 97c71e5
Adding the test again -- Git was crazy :D
leandrodamascena b615bc4
address Heitor comment on e2e test
roger-zhangg ed31a2c
Merge branch 'tz_fix' of github.com:roger-zhangg/aws-lambda-powertool…
roger-zhangg d2734dc
Merge branch 'develop' of https://github.com/aws-powertools/powertool…
roger-zhangg 1143968
Merge branch 'develop' into tz_fix
leandrodamascena 567fb0b
Adding more information in the e2e tests
leandrodamascena 1291490
Merge branch 'develop' into tz_fix
leandrodamascena f38350e
Merge branch 'develop' into tz_fix
heitorlessa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"level": "INFO", | ||
"location": "<module>:16", | ||
"timestamp": "2021-12-30 13:41:53,413+0100", | ||
"timestamp": "2021-12-30 13:41:53,413+0000", | ||
"service": "payment", | ||
"event": "hello" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
import os | ||
import time | ||
|
||
from aws_lambda_powertools import Logger | ||
|
||
logger = Logger(service="payment") | ||
logger.info("Local time") | ||
logger_in_utc = Logger(service="payment") | ||
logger_in_utc.info("Logging with default AWS Lambda timezone: UTC time") | ||
|
||
os.environ["TZ"] = "US/Eastern" | ||
time.tzset() # (1)! | ||
|
||
logger_in_utc = Logger(service="order", utc=True) | ||
logger_in_utc.info("GMT time zone") | ||
logger = Logger(service="order") | ||
logger.info("Logging with US Eastern timezone") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
[ | ||
{ | ||
"level": "INFO", | ||
"location": "<module>:4", | ||
"message": "Local time", | ||
"timestamp": "2022-06-24 11:39:49,421+0200", | ||
"service": "payment" | ||
"level":"INFO", | ||
"location":"<module>:7", | ||
"message":"Logging with default AWS Lambda timezone: UTC time", | ||
"timestamp":"2023-10-09 21:33:55,733+0000", | ||
"service":"payment" | ||
}, | ||
{ | ||
"level": "INFO", | ||
"location": "<module>:7", | ||
"message": "GMT time zone", | ||
"timestamp": "2022-06-24 09:39:49,421+0100", | ||
"service": "order" | ||
"level":"INFO", | ||
"location":"<module>:13", | ||
"message":"Logging with US Eastern timezone", | ||
"timestamp":"2023-10-09 17:33:55,734-0400", | ||
"service":"order" | ||
} | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.