Skip to content

Commit 13a3196

Browse files
committed
docs: set logger with UTC timestamp
1 parent b4e6b3f commit 13a3196

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

docs/core/logger.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -678,22 +678,18 @@ You can change the order of [standard Logger keys](#standard-structured-keys) or
678678

679679
#### Setting timestamp to UTC
680680

681-
By default, this Logger and standard logging library emits records using local time timestamp. You can override this behaviour by updating the current converter set in our formatter:
681+
By default, this Logger and standard logging library emits records using local time timestamp. You can override this behaviour via `utc` parameter:
682682

683683
=== "app.py"
684684

685-
```python hl_lines="1 3 9"
685+
```python hl_lines="6"
686686
from aws_lambda_powertools import Logger
687687

688-
import time
689-
690-
logger = Logger(service="sample_service")
691-
688+
logger = Logger(service="payment")
692689
logger.info("Local time")
693690

694-
logger._logger.handlers[0].formatter.converter = time.gmtime
695-
696-
logger.info("GMT time")
691+
logger_in_utc = Logger(service="payment", utc=True)
692+
logger_in_utc.info("GMT time zone")
697693
```
698694

699695
## Built-in Correlation ID expressions

0 commit comments

Comments
 (0)