Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.25 KB

LogRequestInterceptor.md

File metadata and controls

42 lines (29 loc) · 1.25 KB

LogRequestInterceptor

The LogRequestInterceptor writes the request object to a log.

Usage

The LogRequestInterceptor has a constructor that requires a Logger passed in the constructor. This library includes the ConsoleLogger that you can use.

It is recommended that this be first request interceptor added.

Examples

//TypeScript
import { LogRequestInterceptor, ConsoleLogger, ILogger } from "ask-community-interceptors";

const logger: ILogger = new ConsoleLogger();
const logRequestInterceptor = new LogRequestInterceptor(logger);

exports.handler = skillBuilder
    ...
    .addRequestInterceptors(logRequestInterceptor)
    .lambda();
//JavaScript
const Interceptors = require('ask-community-interceptors');

const logger = new Interceptors.ConsoleLogger();
const logRequestInterceptor = new Interceptors.LogRequestInterceptor(logger);

exports.handler = skillBuilder
    ...
    .addRequestInterceptors(logRequestInterceptor)
    .lambda();

CloudWatch Logs

If your skill is hosted in AWS Lambda then the LogRequestInterceptor will write two entries in the Amazon CloudWatch Logs:

alt text