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
feat(logger): pretty printing logs in local and non-prod environment (#1141)
* test(logger): add tests for POWERTOOLS_DEV env var and for pretty printing logs when var is set to truthy value
* feat(logger): add POWERTOOLS_DEV env var and method to get its value
* test(logger): fix tests adding method that gets value of POWERTOOLS_DEV env var
* feat(logger): add pretty printing to logs if POWERTOOLS_DEV env var set to truthy value
* refactor(review): add private class property for indent size, move evaluation of this property to setOptions()
* test(logger): fix tests according to the changes in default logger config
* docs(logger): update sections for pretty printing logs using POWERTOOLS_DEV env var
* Update docs/core/logger.md
* Update docs/core/logger.md
Co-authored-by: ijemmy <[email protected]>
* fix(docs): update default value for POWERTOOLS_DEV env var
* feat(logger): add isValueTrue method that checks the string value for truthiness
* test(logger): adjust tests for config interface
* test(logger): add tests for isValueTrue method, remove redundunt tests
Co-authored-by: Andrea Amorosi <[email protected]>
Co-authored-by: ijemmy <[email protected]>
Copy file name to clipboardExpand all lines: docs/core/logger.md
+3
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,9 @@ Your Logger will include the following keys to your structured logging (default
104
104
|**xray_trace_id**: `string`|`1-5759e988-bd862e3fe1be46a994272793`| X-Ray Trace ID. This value is always presented in Lambda environment, whether [tracing is enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html){target="_blank"} or not. Logger will always log this value. |
105
105
|**error**: `Object`|`{ name: "Error", location: "/my-project/handler.ts:18", message: "Unexpected error #1", stack: "[stacktrace]"}`| Optional - An object containing information about the Error passed to the logger |
106
106
107
+
???+ info
108
+
When `POWERTOOLS_DEV` environment variable is present and set to `"true"` or `"1"`, Logger will pretty-print log messages for easier readability. We recommend to use this setting only when debugging on local environments.
109
+
107
110
### Capturing Lambda context info
108
111
109
112
You can enrich your structured logs with key Lambda context information in multiple ways.
|**POWERTOOLS_DEV**| Increase JSON indentation to ease debugging when running functions locally or in a non-production environment |[Logger](./core/logger)|`false`|
0 commit comments