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: add logging format configuration and integrate pino logger
- Added `CDK_APP_LOGGING_FORMAT` to configuration schema with options for 'text' and 'json'.
- Integrated pino as the logging library for structured logging.
- Updated logger utility to support both text and JSON formats based on configuration.
- Modified logging statements across the application to include contextual information.
- Enhanced tests to validate logging behavior for both formats.
Copy file name to clipboardExpand all lines: infrastructure/README.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,6 +180,7 @@ All CDK configuration is managed through environment variables prefixed with `CD
180
180
|`CDK_OWNER`| No | Team or owner name | Any string |`unknown`|
181
181
|`CDK_APP_ENABLE_LOGGING`| No | Enable application logging |`true`, `false`|`true`|
182
182
|`CDK_APP_LOGGING_LEVEL`| No | Application logging level |`debug`, `info`, `warn`, `error`|`info`|
183
+
|`CDK_APP_LOGGING_FORMAT`| No | Application logging format |`text`, `json`|`json`|
183
184
184
185
### AWS Account and Region Resolution
185
186
@@ -294,12 +295,18 @@ npm run cdk destroy --all
294
295
295
296
**Logging Configuration:**
296
297
297
-
The Lambda stack uses the `CDK_APP_ENABLE_LOGGING`and `CDK_APP_LOGGING_LEVEL` environment variables to configure application logging:
298
+
The Lambda stack uses the `CDK_APP_ENABLE_LOGGING`, `CDK_APP_LOGGING_LEVEL`, and `CDK_APP_LOGGING_FORMAT` environment variables to configure application logging:
298
299
299
300
-**CDK_APP_ENABLE_LOGGING**: Controls whether logging is enabled in the Lambda functions
300
301
-**CDK_APP_LOGGING_LEVEL**: Sets the minimum log level (`debug`, `info`, `warn`, `error`)
302
+
-**CDK_APP_LOGGING_FORMAT**: Sets the log output format (`text` or `json`)
301
303
302
-
These values are passed to the Lambda functions as environment variables (`ENABLE_LOGGING` and `LOG_LEVEL`) and control both CloudWatch log output and application-level logging behavior.
304
+
These values are passed to the Lambda functions as environment variables (`ENABLE_LOGGING`, `LOG_LEVEL`, and `LOG_FORMAT`) and control both CloudWatch log output and application-level logging behavior.
305
+
306
+
**Log Format Options:**
307
+
308
+
-**json** (default): Structured JSON logs ideal for CloudWatch Logs Insights and log aggregation tools. Each log entry is a JSON object with fields like `timestamp`, `level`, `message`, and any additional context fields.
309
+
-**text**: Human-readable text format with timestamp, level, and message. Context is stringified and appended to the message.
0 commit comments