@@ -249,7 +249,7 @@ A first attempt at the routing logic might look similar to the following code sn
249
249
try:
250
250
route = self.routes[f"{path}-{method}"]
251
251
except KeyError:
252
- raise RuntimeError(f"Cannot route request to correct method. path={path}, method={method}")
252
+ raise RuntimeError(f"Cannot route request to the correct method. path={path}, method={method}")
253
253
return route
254
254
255
255
router = Router()
@@ -402,7 +402,7 @@ The first option could be to use the standard Python Logger, and use a specializ
402
402
403
403
@app.get("/hello")
404
404
def hello():
405
- logger.info(f "Request from unknown received")
405
+ logger.info("Request from unknown received")
406
406
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
407
407
408
408
@@ -476,7 +476,7 @@ As we already have Lambda Powertools as a dependency, we can simply import [Logg
476
476
477
477
@app.get("/hello")
478
478
def hello():
479
- logger.info(f "Request from unknown received")
479
+ logger.info("Request from unknown received")
480
480
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
481
481
482
482
@@ -561,7 +561,7 @@ Let's first explore how we can achieve this with [x-ray SDK](https://docs.aws.am
561
561
def hello():
562
562
with xray_recorder.in_subsegment("hello") as subsegment:
563
563
subsegment.put_annotation("User", "unknown")
564
- logger.info(f "Request from unknown received")
564
+ logger.info("Request from unknown received")
565
565
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
566
566
567
567
@@ -649,7 +649,7 @@ Now, let's try to simplify it with Lambda Powertools:
649
649
@tracer.capture_method
650
650
def hello():
651
651
tracer.put_annotation("User", "unknown")
652
- logger.info(f "Request from unknown received")
652
+ logger.info("Request from unknown received")
653
653
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
654
654
655
655
@@ -738,7 +738,7 @@ Let's expand our application with custom metrics without Powertools to see how i
738
738
@tracer.capture_method
739
739
def hello():
740
740
tracer.put_annotation("User", "unknown")
741
- logger.info(f "Request from unknown received")
741
+ logger.info("Request from unknown received")
742
742
put_metric_data(service=service, method="/hello")
743
743
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
744
744
@@ -823,7 +823,7 @@ To add custom metric in **CloudWatch** we add the `boto3` cloudwatch client. Nex
823
823
@tracer.capture_method
824
824
def hello():
825
825
tracer.put_annotation("User", "unknown")
826
- logger.info(f "Request from unknown received")
826
+ logger.info("Request from unknown received")
827
827
metrics.add_dimension(name="method", value="/hello/<name>")
828
828
metrics.add_metric(name="AppMethodsInvocations", unit=MetricUnit.Count, value=1)
829
829
return {"statusCode": 200, "body": json.dumps({"message": "hello unknown!"})}
0 commit comments