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

express-bunyan-logger

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-bunyan-logger

a bunyan logger middleware for express

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.5K
increased by77.07%
Maintainers
1
Weekly downloads
 
Created
Source

Express-bunyan-logger

A express logger middleware powered by bunyan.

Build Status

Installation

npm install express-bunyan-logger

Usage

To use the logger:

app.use(require('express-bunyan-logger')());

To use the errorLogger:

app.use(require('express-bunyan-logger').errorLogger());

And you can also pass bunyan logger options to the logger middleware:

app.use(require('express-bunyan-logger')({
    name: 'logger', 
    streams: [{
        level: 'info',
        stream: process.stdout
        }]
    }));

Change default format:

app.use(require('express-bunyan-logger')({
    format: ":remote-address - :user-agent[major] custom logger"
});

Configuration

options.format

Format string, please go the source code to the metadata. ":name" will print out meta.name; ":name[key]" will print out the property 'key' of meta.name.

Or you can pass a function to options.format. This function accept a object as argument and return string.

options.parseUA

Whether to parse user-agent in logger, default is =true=.

options.levelFn

Function that translate statusCode into log level.

function(status, err /* only will work in error logger */) {
     // return string of level
     return "info";
}

options.immediate

Write log line on request instead of response (for response times)

License

(The BSD License)

Copyright (c) 2013, Villa.Gao <jky239@gmail.com>;

Keywords

FAQs

Package last updated on 06 May 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