Node Debug Tool
Tiny node.js debugging tool with colors and timing functionality
Table of contents
Installation
$ npm install node-debug-tool
Usage
The DEBUG_MODE
environment variable, must be set to a namespace in order to see the debugging information.
Code example:
var ab = require('../lib/node-debug-tool')('Foo:bar:x');
var abc = require('../lib/node-debug-tool')('foo:bar:y');
var abcd = require('../lib/node-debug-tool')('foo:abc');
var abcde = require('../lib/node-debug-tool')('other');
ab.log('Some foo bar x');
abc.log('Some foo bar y');
abcd.log('Some foo abc');
other.log('Some other');
The code above possible outputs:
- in case of running with
DEBUG_MODE=*
:
[Foo:Bar:X] [Debug] "Some foo bar x" +0ms
[Foo:Bar:Y] [Debug] "Some foo bar y" +0ms
[Foo:Abc] [Debug] "Some foo abc" +0ms
[Other] [Debug] "Some other" +0ms
- in case of running with
DEBUG_MODE=foo:*
:
[Foo:Bar:X] [Debug] "Some foo bar x" +0ms
[Foo:Bar:Y] [Debug] "Some foo bar y" +0ms
[Foo:Abc] [Debug] "Some foo abc" +0ms
- in case of running with
DEBUG_MODE=foo:bar:*
:
[Foo:Bar:X] [Debug] "Some foo bar x" +0ms
[Foo:Bar:Y] [Debug] "Some foo bar y" +0ms
- in case of running with
DEBUG_MODE=foo:bar:x
:
[Foo:Bar:X] [Debug] "Some foo bar x" +0ms