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

churchill

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

churchill

Simple express logger for winston

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
69
increased by331.25%
Maintainers
1
Weekly downloads
 
Created
Source

churchill

A winston express logger called churchill

Installing

npm install churchill

Running the tests

npm test

Usage

var churchill = require('churchill');
app.use(require('churchill')(winston));

Specify a log level

app.use(require('churchill')(winston, 'express'));

Using multiple loggers

var logger = new (winston.Logger).....
app.use(require('churchill').add(logger, 'express').add(logger, 'someOtherLogLevel'));

req.logger The first logger will be automatically added to req.logger This then gives you the facility to use the logger from req like so:

req.logger.log('something in winston');
req.logger.error('Oh noe!');

req.log Churchill will also add a log method to the request object, which will log to all mounted loggers:

req.log('info', 'something in winston');
req.log('error', 'OH NO!');

To disable this set reqLogger to false in the options.

Formatting

var logger = new (winston.Logger).....
app.use(require('churchill').add(logger, 'express').format(function (obj, req, res) {
  obj.somethingInteresting = req.params.moreData;
}));

Suppressing GET params from logs

var churchill = require('churchill')
churchill.options.logGetParams = false

Output

In it's simplest form a console output looks like this:

info:  status=200, method=GET, url=/, response_time=4
info:  status=304, method=GET, url=/, response_time=1
info:  status=304, method=GET, url=/, response_time=0

Examples

To run the examples go into the example dir and npm install then just node simple or node multiple to see them in action.

FAQs

Package last updated on 07 Jun 2017

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