You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(logger): remove logEvent from required settings (#1821)
* docs: removed required settings and added section for envs
* fix typo
* remove env section in logs, adjust woring and link to api and index page
* clarified wording on logEvent
|**Service name**| Sets the name of service of which the Lambda function is part of, that will be present across all log statements |`POWERTOOLS_SERVICE_NAME`|`service_undefined`| Any string |`serverlessAirline`|`serviceName`|
52
51
|**Logging level**| Sets how verbose Logger should be, from the most verbose to the least verbose (no logs) |`POWERTOOLS_LOG_LEVEL`|`INFO`|`DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `SILENT`|`ERROR`|`logLevel`|
53
-
|**Log incoming event**| Whether to log or not the incoming event when using the decorator or middleware |`POWERTOOLS_LOGGER_LOG_EVENT`|`false`|`true`, `false`|`false`|`logEvent`|
54
-
|**Debug log sampling**| Probability that a Lambda invocation will print all the log items regardless of the log level setting |`POWERTOOLS_LOGGER_SAMPLE_RATE`|`0`|`0.0` to `1`|`0.5`|`sampleRateValue`|
52
+
|**Sample rate**| Probability that a Lambda invocation will print all the log items regardless of the log level setting |`POWERTOOLS_LOGGER_SAMPLE_RATE`|`0`|`0.0` to `1.0`|`0.1`|`sampleRateValue`|
53
+
54
+
See all enivronment variables in the [Environment variables](../index.md/#environment-variables) section.
55
+
Check API docs to learn more about [Logger constructor options](https://docs.powertools.aws.dev/lambda/typescript/latest/api/types/_aws_lambda_powertools_logger.types.ConstructorOptions.html){target="_blank"}.
55
56
56
57
#### Example using AWS Serverless Application Model (SAM)
57
58
@@ -153,9 +154,9 @@ In each case, the printed log will look like this:
153
154
}
154
155
```
155
156
156
-
####Log incoming event
157
+
### Log incoming event
157
158
158
-
When debugging in non-production environments, you can instruct Logger to log the incoming event with the middleware/decorator parameter `logEvent` or via `POWERTOOLS_LOGGER_LOG_EVENT` env var set to `true`.
159
+
When debugging in non-production environments, you can instruct Logger to log the incoming event with the middleware/decorator parameter `logEvent`.
159
160
160
161
???+ warning
161
162
This is disabled by default to prevent sensitive info being logged
@@ -174,6 +175,8 @@ When debugging in non-production environments, you can instruct Logger to log th
174
175
175
176
1. Binding your handler method allows your handler to access `this` within the class methods.
176
177
178
+
Use `POWERTOOLS_LOGGER_LOG_EVENT` environment variable to enable or disable (`true`/`false`) this feature.
179
+
177
180
### Appending persistent additional log keys and values
178
181
179
182
You can append additional persistent keys and values in the logs generated during a Lambda invocation using either mechanism:
@@ -389,7 +392,6 @@ The error will be logged with default key name `error`, but you can also pass yo
389
392
!!! tip "Logging errors and log level"
390
393
You can also log errors using the `warn`, `info`, and `debug` methods. Be aware of the log level though, you might miss those errors when analyzing the log later depending on the log level configuration.
0 commit comments