Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunyan-pilgrim

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-pilgrim

A REST-oriented logger for Bunyan

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

bunyan-pilgrim

Pilgrim is a logging stream for trentm's node-bunyan module designed to work in conjunction with mcavage's node-restify server.

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.

Installation

npm install bunyan-pilgrim

Usage


var bunyan = require('bunyan');
var Pilgrim = require('bunyan-pilgrim');

var logger = bunyan.createLogger({
  name: 'Pilgrim Test',
  streams: [
    {
      level: 'info',
      stream: new Pilgrim({
        from: 400,
        to: 499,
        stream: '/var/log/app-client-errors.log',
        ignore: [401]
      })
    },
    {
      level: 'info',
      stream: new Pilgrim({
        from: 500,
        to: 599,
        stream: '/var/log/app-server-errors.log'
      })
    }
  ]
});

server = restify.createServer({
  log: logger,
});

Configuration

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 from and to but should be ignored anyway.

Contributing

Contributions are welcome… particularly if accompanied by a unit test.

Keywords

FAQs

Package last updated on 21 Apr 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc