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
Copy file name to clipboardExpand all lines: README.md
+49-9Lines changed: 49 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,9 +140,46 @@ Output
140
140
}
141
141
```
142
142
143
-
##Customize output format
143
+
### Lambda Structured Log Format
144
144
145
-
By default, the `pinoLambdaDestination` uses the `CloudwatchLogFormatter`. If you want the request tracing features of `pino-lambda`, but don't need the Cloudwatch format, you can use the `PinoLogFormatter` which matches the default object output format of `pino`.
145
+
By default, the `pinoLambdaDestination` uses the `CloudwatchLogFormatter`.
146
+
147
+
If you would like to use the new [AWS Lambda Advanced Logging Controls](https://aws.amazon.com/blogs/compute/introducing-advanced-logging-controls-for-aws-lambda-functions/) format for your logs, ensure your Lambda function is properly configured and enable `StructuredLogFormatter` in `pino-lambda`.
If you want the request tracing features of `pino-lambda`, but don't need the Cloudwatch format, you can use the `PinoLogFormatter` which matches the default object output format of `pino`.
146
183
147
184
```ts
148
185
importpinofrom'pino';
@@ -162,16 +199,19 @@ async function handler(event, context) {
Copy file name to clipboardExpand all lines: tap-snapshots/src/tests/index.spec.ts.test.cjs
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,10 @@ exports[`src/tests/index.spec.ts TAP should allow removing default request data
25
25
2016-12-01T06:00:00.000Z 431234 INFO Message with trace ID {"awsRequestId":"431234","level":30,"time":1480572000000,"msg":"Message with trace ID"}
26
26
`
27
27
28
+
exports[`src/tests/index.spec.ts TAP should allow structured logging format for cloudwatch > must match snapshot 1`]=`
29
+
{"timestamp":"2016-12-01T06:00:00.000Z","level":"INFO","requestId":"431234","message":{"x-correlation-id":"431234","time":1480572000000,"msg":"Message with pino formatter"}}
30
+
`
31
+
28
32
exports[`src/tests/index.spec.ts TAP should capture custom request data > must match snapshot 1`]=`
29
33
2016-12-01T06:00:00.000Z 431234 INFO Message with trace ID {"awsRequestId":"431234","x-correlation-id":"431234","host":"www.host.com","level":30,"time":1480572000000,"msg":"Message with trace ID"}
0 commit comments