middy-awesome-logs
v0.1.3
Published
Middy middleware that logs requests
Downloads
10
Maintainers
Readme
middy-awesome-logs
Description
This package provides a middy Middleware that logs requests and responses. It is based on @middy/input-out-logger middleware.
Why
@middy/input-out-logger is great but since it requires @middy/core I decided to create something that was useful for all those that still work with middy.
Install
$ npm install middy-awesome-logs
Options
logger property accept a function (default console.log).
Usage
const middy = require('middy');
const awesomeLogs = require('middy-awesome-logs');
const handler = middy((event, context, cb) => {
const response = {
statusCode: 200,
headers: {},
body: JSON.stringify({ message: 'hello world' })
};
callback(null, response)
});
handler.use(awesomeLogs());