Skip to content

Commit

Permalink
docs: document new get_correlation_id
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Jul 20, 2021
1 parent cb0d54b commit c618d8f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ When debugging in non-production environments, you can instruct Logger to log th

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

!!! tip "You can retrieve correlation IDs via `get_correlation_id` method"

=== "collect.py"

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

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

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

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

Expand Down

0 comments on commit c618d8f

Please sign in to comment.