Skip to content

Commit 44db087

Browse files
committed
docs: fix typos, log_event & sampling wording
Signed-off-by: heitorlessa <[email protected]>
1 parent 10cb3a9 commit 44db087

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

docs/content/core/logger.mdx

+19-18
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Key | Type | Example | Description
5858
**sampling_rate** | int | 0.1 | Debug logging sampling rate in percentage e.g. 1% in this case
5959
**message** | any | "Collecting payment" | Log statement value. Unserializable JSON values will be casted to string
6060

61-
## Capturing context Lambda info
61+
## Capturing Lambda context info
6262

6363
You can enrich your structured logs with key Lambda context information via `inject_lambda_context`.
6464

@@ -79,22 +79,6 @@ def handler(event, context):
7979
...
8080
```
8181

82-
You can also explicitly log any incoming event using `log_event` param or via `POWERTOOLS_LOGGER_LOG_EVENT` env var.
83-
84-
<Note type="warning">
85-
This is disabled by default to prevent sensitive info being logged.
86-
</Note><br/>
87-
88-
```python:title=log_handler_event.py
89-
from aws_lambda_powertools import Logger
90-
91-
logger = Logger()
92-
93-
@logger.inject_lambda_context(log_event=True) # highlight-start
94-
def handler(event, context):
95-
...
96-
```
97-
9882
When used, this will include the following keys:
9983

10084
Key | Type | Example
@@ -145,6 +129,23 @@ Key | Type | Example
145129
}
146130
```
147131
</details>
132+
<br/>
133+
134+
You can also explicitly log any incoming event using `log_event` param or via `POWERTOOLS_LOGGER_LOG_EVENT` env var.
135+
136+
<Note type="warning">
137+
This is disabled by default to prevent sensitive info being logged.
138+
</Note><br/>
139+
140+
```python:title=log_handler_event.py
141+
from aws_lambda_powertools import Logger
142+
143+
logger = Logger()
144+
145+
@logger.inject_lambda_context(log_event=True) # highlight-line
146+
def handler(event, context):
147+
...
148+
```
148149

149150
## Appending additional keys
150151

@@ -222,7 +223,7 @@ If you ever forget to use `child` param, we will return an existing `Logger` wit
222223

223224
You can dynamically set a percentage of your logs to **DEBUG** level using `sample_rate` param or via env var `POWERTOOLS_LOGGER_SAMPLE_RATE`.
224225

225-
This happens on an entire request basis, and <strong>DEBUG</strong> level is set at the constructor. That means, concurrent requests or infrequent invocations are more likely to occur as [new Lambda execution contexts are created](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html), not reused.
226+
Sampling calculation happens at the Logger class initialization. This means, when configured it, sampling it's more likely to happen during concurrent requests, or infrequent invocations as [new Lambda execution contexts are created](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html), not reused.
226227

227228
<Note type="info">
228229
If you want this logic to happen on every invocation regardless whether Lambda reuses the execution environment or not, then create your Logger inside your Lambda handler.

0 commit comments

Comments
 (0)