UNPKG

watchlog

Version:

Fast logger with multiple outputs and verbosity settings

39 lines (31 loc) 797 B
# 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