PopovMP / req-log

A simple and fats request logger for express

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A simple and fats request logger for express


Languages

Language:JavaScript 100.0%