From 8ceb91cf5efd954c1f43513540ce2abd0cd4e28c Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Tue, 20 Jul 2021 10:20:40 +0200 Subject: [PATCH] docs(logger): document new get_correlation_id method (#545) --- docs/core/logger.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/core/logger.md b/docs/core/logger.md index 43d367e171b..53818bada51 100644 --- a/docs/core/logger.md +++ b/docs/core/logger.md @@ -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" @@ -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") ``` @@ -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") ```