Socket
Book a DemoInstallSign in
Socket

koa-log-requests

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-log-requests

Log request method, path, status, time spent and body

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
6
200%
Maintainers
1
Weekly downloads
 
Created
Source

koa-log-requests

Customizable Koa middleware for logging incoming requests. Outputs method, path, response status, time spent and request body.

Installation

$ npm install koa-log-requests --save

Usage

var koa = require('koa');
var requests = require('koa-log-requests');

var app = koa();

app.use(requests());
app.use(function * (next) {
	this.body = 'Hello World';
	
	yield next;
});

app.listen(3000);

Options

There are few options, that you can customize:

var requests = require('koa-log-requests');

requests.indent = 2; // insert N spaces at the beginning
requests.format = ':method :path status=:status time=:time body=:body'; // format of output
requests.filter = ['password', 'password_confirmation']; // filter out these keys from request body

License

koa-log-requests is released under the MIT license.

Keywords

koa

FAQs

Package last updated on 15 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts