Skip to content

Commit 0356025

Browse files
committed
docs: add xray_trace_id key
1 parent a7d9001 commit 0356025

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/content/core/logger.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Logger(service="payment", level="INFO")
4747

4848
## Standard structured keys
4949

50-
Your Logger will always include the following keys to your structured logging:
50+
Your Logger will include the following keys to your structured logging, by default:
5151

5252
Key | Type | Example | Description
5353
------------------------------------------------- | ------------------------------------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------
@@ -57,6 +57,7 @@ Key | Type | Example | Description
5757
**service** | str | "payment" | Service name defined. "service_undefined" will be used if unknown
5858
**sampling_rate** | int | 0.1 | Debug logging sampling rate in percentage e.g. 10% in this case
5959
**message** | any | "Collecting payment" | Log statement value. Unserializable JSON values will be casted to string
60+
**xray_trace_id** | str | "1-5759e988-bd862e3fe1be46a994272793" | X-Ray Trace ID when Lambda function has enabled Tracing
6061

6162
## Capturing Lambda context info
6263

@@ -304,7 +305,7 @@ This can be fixed by either ensuring both has the `service` value as `payment`,
304305

305306
You might want to continue to use the same date formatting style, or override `location` to display the `package.function_name:line_number` as you previously had.
306307

307-
Logger allows you to either change the format or suppress the following keys altogether at the initialization: `location`, `timestamp`, `level`, and `datefmt`
308+
Logger allows you to either change the format or suppress the following keys altogether at the initialization: `location`, `timestamp`, `level`, `xray_trace_id`, and `datefmt`
308309

309310
```python
310311
from aws_lambda_powertools import Logger
@@ -316,7 +317,7 @@ logger = Logger(stream=stdout, location="[%(funcName)s] %(module)s", datefmt="fa
316317
logger = Logger(stream=stdout, location=None) # highlight-line
317318
```
318319

319-
Alternatively, you can also change the order of the following log record keys via the `log_record_order` parameter: `level`, location`, message`, and timestamp`
320+
Alternatively, you can also change the order of the following log record keys via the `log_record_order` parameter: `level`, `location`, `message`, `xray_trace_id`, and `timestamp`
320321

321322
```python
322323
from aws_lambda_powertools import Logger

0 commit comments

Comments
 (0)