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

bunlogger

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

bunlogger

bunyan logger middleware for express/connect

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

bunlogger

express middleware powered by bunyan

Installation

$ npm install bunlogger --save

Features

  1. error log and access log share the same cor_id, so you can associate the error log to the access log happened at the same time.
  2. req.log is actually the bunyan logger, simply req.log.info('...') will share the same cor_id in the access log and error log.
  3. elapsed show the time spent in this req.

Usage

###app.js

const express = require('express');
const config = require('config');
const Bunlog = require('bunlogger');

   
// set up app
//===============
var app = express();
var logger = Bunlog(config.bunlog);

// as a middleware
app.use(logger.connect());

// as an error middleware
app.use(logger.error());

###config/index.js

const join = require('path').join;
const pkgname = require('../package.json').name;
const production = process.env.NODE_ENV == 'production';


  // logging config
var bunlog = {name: pkgname};
if (production) bunlog.path = join(__dirname, '..', 'logs', pkgname + '.log');

exports.bunlog = bunlog;

FAQs

Package last updated on 07 Apr 2016

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