New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

iso-bunyan-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iso-bunyan-stream

An isomorphic bunyan stream for development.

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

Isomorphic Bunyan Stream

Just what it says on the label: a simple, isomorphic Bunyan stream for use in Node and the browser. It's intended to be used only for development, so all context gets stripped out: only the message, level, logger name, and a simple timestamp are displayed.

Why is this useful?

Isomorphic applications, as much or moreso than client-only, single-page web applications, are a distributed computing problem. Good logs provide a simple, sane way to reason about the flow of information through such a distributed system, but we need a way to reason about all actors involved, including the browser. As such, we're well-served by a consistent stream shared between both types of actor: the client (browsers) and the server (Node).

Installation

As always, it's just an NPM module:

npm install --save iso-bunyan-stream

Usage

The stream requires being added in raw mode:

var bunyan = require('bunyan');
var logger = bunyan.createLogger({
  name: 'SomeApp',
  streams: [{
    level: 'info',
    type: 'raw',
    stream: {
      write: function (record) {
        console.log('%s %s| %s: %s', colors.grey(record.name), colors.grey(record.time.toLocaleTimeString()), colors[LEVEL_COLORS[record.level]](LEVEL_NAMES[record.level]), record.msg);
      }
    }
  }]
});

FAQs

Package last updated on 02 Dec 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