1.0.1 • Published 4 years ago

@popovmp/req-log v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Request Logger for Express

Simple request logger for express.

Usage

const { reqLog } = require('@popovmp/req-log')

app.use( reqLog() ) // app is an express application

req-log prints stats for the requests in columns as follows:

  • HTTP status code: 200, 304, 404, 500, ...
  • Request verb: POST, GET, HEAD, ...
  • Request time in milliseconds or seconds: 22, 1.3s
  • The transaction size. It prints the response size on GET and the request size on POST
  • The path

req-log

API

You can use reeq-log without parameters to print all requests.

app.use( reqLog() )

Yuo can also add as a parameter the list of paths you want to ignore for logging.

app.use( reqLog( ['favicon.ico', 'ignore/path-1', 'ignore/path-2'] ))

license

MIT