Skip to content

Commit c618d8f

Browse files
committed
docs: document new get_correlation_id
1 parent cb0d54b commit c618d8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: docs/core/logger.md

+4
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ When debugging in non-production environments, you can instruct Logger to log th
146146

147147
You can set a Correlation ID using `correlation_id_path` param by passing a [JMESPath expression](https://jmespath.org/tutorial.html){target="_blank"}.
148148

149+
!!! tip "You can retrieve correlation IDs via `get_correlation_id` method"
150+
149151
=== "collect.py"
150152

151153
```python hl_lines="5"
@@ -155,6 +157,7 @@ You can set a Correlation ID using `correlation_id_path` param by passing a [JME
155157

156158
@logger.inject_lambda_context(correlation_id_path="headers.my_request_id_header")
157159
def handler(event, context):
160+
logger.debug(f"Correlation ID => {logger.get_correlation_id()}")
158161
logger.info("Collecting payment")
159162
```
160163

@@ -198,6 +201,7 @@ We provide [built-in JMESPath expressions](#built-in-correlation-id-expressions)
198201

199202
@logger.inject_lambda_context(correlation_id_path=correlation_paths.API_GATEWAY_REST)
200203
def handler(event, context):
204+
logger.debug(f"Correlation ID => {logger.get_correlation_id()}")
201205
logger.info("Collecting payment")
202206
```
203207

0 commit comments

Comments
 (0)