diff --git a/packages/cli/src/commands/generate/function/__tests__/__snapshots__/function.test.ts.snap b/packages/cli/src/commands/generate/function/__tests__/__snapshots__/function.test.ts.snap index f5b105ade1b6..76f30b5566e3 100644 --- a/packages/cli/src/commands/generate/function/__tests__/__snapshots__/function.test.ts.snap +++ b/packages/cli/src/commands/generate/function/__tests__/__snapshots__/function.test.ts.snap @@ -19,8 +19,8 @@ exports[`Single word default files creates a single word function file 1`] = ` * @param { Context } context - contains information about the invocation, * function, and execution environment. */ -export const handler = async (event, context) => { - logger.info('Invoked foo function') +export const handler = async (event, _context) => { + logger.info(\`\${event.httpMethod} \${event.path}: foo function\`) return { statusCode: 200, @@ -95,8 +95,8 @@ exports[`creates a .js file if --javascript=true 1`] = ` * @param { Context } context - contains information about the invocation, * function, and execution environment. */ -export const handler = async (event, context) => { - logger.info('Invoked javascriptFunction function') +export const handler = async (event, _context) => { + logger.info(\`\${event.httpMethod} \${event.path}: javascriptFunction function\`) return { statusCode: 200, @@ -113,6 +113,7 @@ export const handler = async (event, context) => { exports[`creates a .ts file if --typescript=true 1`] = ` "import type { APIGatewayEvent, Context } from 'aws-lambda' + import { logger } from 'src/lib/logger' /** @@ -131,8 +132,8 @@ import { logger } from 'src/lib/logger' * @param { Context } context - contains information about the invocation, * function, and execution environment. */ -export const handler = async (event: APIGatewayEvent, context: Context) => { - logger.info('Invoked typescriptFunction function') +export const handler = async (event: APIGatewayEvent, _context: Context) => { + logger.info(\`\${event.httpMethod} \${event.path}: typescriptFunction function\`) return { statusCode: 200, @@ -166,8 +167,8 @@ exports[`creates a multi word function file 1`] = ` * @param { Context } context - contains information about the invocation, * function, and execution environment. */ -export const handler = async (event, context) => { - logger.info('Invoked sendMail function') +export const handler = async (event, _context) => { + logger.info(\`\${event.httpMethod} \${event.path}: sendMail function\`) return { statusCode: 200, diff --git a/packages/cli/src/commands/generate/function/templates/function.ts.template b/packages/cli/src/commands/generate/function/templates/function.ts.template index 50b29cd83eb5..25a302ec0f21 100644 --- a/packages/cli/src/commands/generate/function/templates/function.ts.template +++ b/packages/cli/src/commands/generate/function/templates/function.ts.template @@ -1,4 +1,5 @@ import type { APIGatewayEvent, Context } from 'aws-lambda' + import { logger } from 'src/lib/logger' /** @@ -17,8 +18,8 @@ import { logger } from 'src/lib/logger' * @param { Context } context - contains information about the invocation, * function, and execution environment. */ -export const handler = async (event: APIGatewayEvent, context: Context) => { - logger.info('Invoked ${name} function') +export const handler = async (event: APIGatewayEvent, _context: Context) => { + logger.info(`<%= '$' %>{event.httpMethod} <%= '$' %>{event.path}: <%= name %> function`) return { statusCode: 200,