node-depugger
Depugger is a small lib that provides a debugging utility.
Installation
$ npm install depugger
depugger([debug, [name]]), depugger(options)
depugger
returns a function that supports all of the util.format
features and outputs debug messages based on the initial configuration.
debug
: specifies if logged messages should be outputted, optional, default: falsename
: a category key that will prepend every message, optional, default: ""options
: options hash that can be used to submit all of the above parameters at once
var depugger = require('depugger');
var debug = depugger(true, 'fooDebugger');
debug('foo');
debug('bar "%s"', 'bax');
debug('spam %d eggs', 10);
Alternatively all parameters can be specified via an options hash:
var depugger = require('depugger');
var debug = depugger({debug: true, name: 'fooDebugger'});
debug('foo');
debug('bar "%s"', 'bax');
debug('spam %d eggs', 10);
depugger.child(childName)
Creates a child instance. The name of the parent's debugger will be concatenated with the childDebugger's name:
var depugger = require('depugger');
var debug = depugger({debug: true, name: 'fooDebugger'});
var childDebug = debug.child('child');
childDebug('foo');