1.0.0 • Published 11 years ago
depugger v1.0.0
node-depugger 
Depugger is a small lib that provides a debugging utility.
Installation
$ npm install depuggerdepugger([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);
//output to console:
//[fooDebugger] foo
//[fooDebugger] bar "bax"
//[fooDebugger] spam 10 eggsAlternatively 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);
//output to console:
//[fooDebugger] foo
//[fooDebugger] bar "bax"
//[fooDebugger] spam 10 eggsdepugger.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');
//output to console:
//[fooDebugger.child] foo
