A REST-oriented logger for Bunyan
It allows you to direct a specific range of status codes to individual log files. For example, you can easily separate all client errors (4xx) from server errors (5xx) and successful requests (2xx) into a separate file for each category.
You can also ignore specific error codes, giving you greater control over your logging operations.
npm install bunyan-pilgrim
var bunyan = require'bunyan';var Pilgrim = require'bunyan-pilgrim';var logger = bunyancreateLoggername: 'Pilgrim Test'streams:level: 'info'stream:from: 400to: 499stream: '/var/log/app-client-errors.log'ignore: 401level: 'info'stream:from: 500to: 599stream: '/var/log/app-server-errors.log';server = restifycreateServerlog: logger;
Each Pilgrim is configured with a hash that includes the following:
from: the first status code that must be captured in this log
to: the last status code that msut be captured in this log
stream: either a string containing the path of the log file, or an instance of Stream.Writable.
ignore: an optional array of status codes that fall between
tobut should be ignored anyway.
Contributions are welcome… particularly if accompanied by a unit test.