watchlog

0.0.4 • Public • Published

Watchlog

Fast logger with multiple outputs and verbosity settings

Usage

'use strict'
const Watchlog = require('watchlog')
const logopts = {
  verbosity: 1,
  output: [console.log, console.log]
}

function TestObject () {
  this.logger = new Watchlog(logopts)
}

TestObject.prototype.sayHi = function () {
  const vMin = 1 // Verbosity minimum (defaults to 1)
  const vMax = 2 // Verbosity maximum (defaults to infinity)

  this.logger.log('Hi one!')
  // console output:
  // 'Hi one!'
  // 'Hi one!'

  this.logger.log('Hi two!', vMin, vMax)
  // console output:
  // 'Hi two!'
  // 'Hi two!'

  this.logger.log('Hi nah', 2, 2)
  // Does not output anything
}

new TestObject().sayHi()

Compatibility

Node.JS versions: 4.x.x, 5.x.x and 6.x.x

Readme

Keywords

Package Sidebar

Install

npm i watchlog

Weekly Downloads

0

Version

0.0.4

License

MIT

Last publish

Collaborators

  • wuhkuh