File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -145,22 +145,23 @@ Key | Example
145
145
146
146
=== "Decorator"
147
147
148
- ```typescript hl_lines="7 "
148
+ ```typescript hl_lines="8 "
149
149
import { Logger } from "@aws-lambda-powertools/logger";
150
+ import { LambdaInterface } from '@aws-lambda-powertools/commons';
150
151
151
152
const logger = new Logger();
152
153
153
- class Lambda {
154
+ class Lambda extends LambdaInterface {
154
155
// Decorate your handler class method
155
156
@logger.injectLambdaContext()
156
- public handler(_event: any, _context: any) {
157
+ public async handler(_event: any, _context: any): Promise<unknown> {
157
158
logger.info("This is an INFO log with some context");
158
159
}
159
160
160
161
}
161
162
162
- export const handlerClass = new Lambda();
163
- export const handler = handlerClass .handler;
163
+ export const myFunction = new Lambda();
164
+ export const handler = myFunction .handler;
164
165
```
165
166
166
167
In each case, the printed log will look like this:
You can’t perform that action at this time.
0 commit comments