Skip to content

Commit 3ed5038

Browse files
committed
docs: add a banner on caplog fixture
1 parent 5354701 commit 3ed5038

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/core/logger.md

+5
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,8 @@ Name | Expression | Description
843843

844844
## Testing your code
845845

846+
### Inject Lambda Context
847+
846848
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.
847849

848850
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
894896
your_lambda_handler(test_event, lambda_context)
895897
```
896898

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+
897902
### Pytest live log feature
898903

899904
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

Comments
 (0)