You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/logger.md
+5
Original file line number
Diff line number
Diff line change
@@ -843,6 +843,8 @@ Name | Expression | Description
843
843
844
844
## Testing your code
845
845
846
+
### Inject Lambda Context
847
+
846
848
When unit testing your code that makes use of `inject_lambda_context` decorator, you need to pass a dummy Lambda Context, or else Logger will fail.
847
849
848
850
This is a Pytest sample that provides the minimum information necessary for Logger to succeed:
@@ -894,6 +896,9 @@ This is a Pytest sample that provides the minimum information necessary for Logg
894
896
your_lambda_handler(test_event, lambda_context)
895
897
```
896
898
899
+
!!! tip
900
+
If you're using pytest and are looking to assert plain log messages, do check out the built-in [caplog fixture](https://docs.pytest.org/en/latest/how-to/logging.html).
901
+
897
902
### Pytest live log feature
898
903
899
904
Pytest Live Log feature duplicates emitted log messages in order to style log statements according to their levels, for this to work use `POWERTOOLS_LOG_DEDUPLICATION_DISABLED` env var.
0 commit comments