Socket
Book a DemoInstallSign in
Socket

bunyan-logger

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-logger

Extend Bunyan to have default options and predefined streams etc.

1.0.0
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

Bunyan Logger

Build Status Coverage Status

Extend Bunyan to have default options and predefined streams etc.

Usage

npm install bunyan-logger
const Logger = require('bunyan-logger');

Examples

Simple

const Logger = require('bunyan-logger');
const logger = new Logger({ stream: 'debug' });
logger.error(new Error('Lorem'));

With Express

See express-bunyan-logger.

const Logger = require('bunyan-logger');
const expressLogger = require('express-bunyan-logger');
app.use(expressLogger({
  logger: new Logger({ stream: 'debug' })
}));

Predefined streams

Debug

See bunyan-debug-stream.

// Simple.
const logger = new Logger({ stream: 'debug' });

// With options.
const logger = new Logger({
  name: 'myLog',
  stream: {
    name: 'debug',
    basepath: path.resolve(__dirname, '../')
  },
  serializers: require('bunyan-debug-stream').serializers
});

File

// Simple.
const logger = new Logger({ stream: 'file' });

// With options.
const logger = new Logger({
  name: 'myLog',
  stream: {
    name: 'file',
    path: './some.log'
  }
});

RingBuffer

const logger = new Logger({ stream: 'ringbuffer' });

Stdout

const logger = new Logger({ stream: 'stdout' });

Syslog

// Simple.
const logger = new Logger({ stream: 'syslog' });

// With options.
const logger = new Logger({
  name: 'myLog',
  stream: {
    name: 'syslog',
    host: '10.0.0.1'
  }
});

Extending/overriding predefined streams

See /example.

Keywords

bunyan

FAQs

Package last updated on 05 Aug 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.