File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -860,7 +860,10 @@ there might be cases where you have some shared routes for multiple lambdas like
860
860
to be used with Application Load Balancer.
861
861
862
862
Below is an example project layout for AWS Lambda Functions using AWS SAM CLI that allows for relative path
863
- imports (ie: ` from .routers import health ` ).
863
+ imports (ie: ` from .routers import health ` ).
864
+
865
+ !!! tip "See in ` src/app/main.py ` , when including a route we can add a prefix to those routes ie: ` prefix="/health" ` ."
866
+ !!! tip "See in ` src/app/routers/health.py ` , when adding a child logger we use ` Logger(child=True) ` ."
864
867
865
868
=== "Project layout"
866
869
@@ -977,16 +980,19 @@ imports (ie: `from .routers import health` ).
977
980
978
981
=== "src/app/routers/health.py"
979
982
980
- ```python hl_lines="3 5 8 "
983
+ ```python hl_lines="4 6-7 10 12 "
981
984
from typing import Dict
982
985
986
+ from aws_lambda_powertools import Logger
983
987
from aws_lambda_powertools.event_handler.api_gateway import Router
984
988
989
+ logger = Logger(child=True)
985
990
router = Router()
986
991
987
992
988
993
@router.get("/status")
989
994
def health() -> Dict:
995
+ logger.debug("Health check called")
990
996
return {"status": "OK"}
991
997
```
992
998
You can’t perform that action at this time.
0 commit comments