lambda-logger-middleware
A simple, configurable logging middleware for Middy.
This middleware logs events and responses using your logger's debug
function and errors using its error
function.
The logger can be replaced (default is console
) so you can configure your logger to log at the appropriate level.
Installation
npm install lambda-logger-middleware --save
Example using Pino
Pino is an excellent, fast, structured JSON logger. It can be configured with lambda-logger-middleware
to only output DEBUG
logs when you are running with STAGE=dev
or with serverless-offline as follows.
const loggerMiddleware = { ... }