The Logger instance(s) to use for logging
Optional
options: HandlerOptions(optional) Options for the middleware
import { Logger, injectLambdaContext } from '@aws-lambda-powertools/logger';
import middy from '@middy/core';
const logger = new Logger();
const lambdaHandler = async (_event: any, _context: any) => {
logger.info('This is an INFO log with some context');
};
export const handler = middy(lambdaHandler).use(injectLambdaContext(logger));
Generated using TypeDoc
A middy middleware that helps emitting CloudWatch EMF metrics in your logs.
Using this middleware on your handler function will automatically add context information to logs, as well as optionally log the event and clear attributes set during the invocation.