@@ -320,9 +320,7 @@ Let's include Lambda Powertools as a dependency in `requirement.txt`, and use Ev
320320
321321=== "app.py"
322322
323- ```python hl_lines="3 5 8 13 19"
324- import json
325-
323+ ```python hl_lines="1 3 6 11 17"
326324 from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
327325
328326 app = ApiGatewayResolver()
@@ -375,13 +373,11 @@ The first option could be to use the standard Python Logger, and use a specializ
375373
376374=== "app.py"
377375
378- ```python hl_lines="2 5 9-14 21 27 32"
379- import json
376+ ```python hl_lines="4 5 7-12 19 25 30"
380377 import logging
381378 import os
382379
383380 from pythonjsonlogger import jsonlogger
384-
385381 from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
386382
387383 logger = logging.getLogger("APP")
@@ -454,9 +450,7 @@ We could start by creating a dictionary with Lambda context information or somet
454450
455451As we already have Lambda Powertools as a dependency, we can simply import [ Logger] ( ./core/logger.md ) {target="_ blank"}.
456452
457- ``` python title="Refactoring with Lambda Powertools Logger" hl_lines="3 5 7 14 20 24"
458- import json
459-
453+ ``` python title="Refactoring with Lambda Powertools Logger" hl_lines="1 3 5 12 18 22"
460454from aws_lambda_powertools import Logger
461455from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
462456from aws_lambda_powertools.logging import correlation_paths
@@ -535,9 +529,7 @@ It's a [two-step process](https://docs.aws.amazon.com/lambda/latest/dg/services-
535529
536530=== "app.py"
537531
538- ```python hl_lines="3 12 16 23 30"
539- import json
540-
532+ ```python hl_lines="1 10 14 21 28"
541533 from aws_xray_sdk.core import patch_all, xray_recorder
542534
543535 from aws_lambda_powertools import Logger
@@ -648,9 +640,7 @@ Within AWS X-Ray, we can answer these questions by using two features: tracing *
648640
649641Let's put them into action.
650642
651- ``` python title="Enriching traces with annotations and metadata" hl_lines="12 19-20 28-29 37 39-44 47"
652- import json
653-
643+ ``` python title="Enriching traces with annotations and metadata" hl_lines="10 17-19 26-27 35 37-42 45"
654644from aws_xray_sdk.core import patch_all, xray_recorder
655645
656646from aws_lambda_powertools import Logger
@@ -729,9 +719,7 @@ We can simplify our previous patterns by using [Lambda Powertools Tracer](core/t
729719!!! note
730720 You can now safely remove ` aws-xray-sdk ` from ` requirements.txt ` ; keep ` aws-lambda-powertools ` only.
731721
732- ``` python title="Refactoring with Lambda Powertools Tracer" hl_lines="3 8 13 15 21 23 29"
733- import json
734-
722+ ``` python title="Refactoring with Lambda Powertools Tracer" hl_lines="1 6 11 13 19 21 27"
735723from aws_lambda_powertools import Logger, Tracer
736724from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
737725from aws_lambda_powertools.logging import correlation_paths
0 commit comments