new FilteredFormatter()
A formatter that suppports usages like visonmedia/debug. DEBUG
env variable used to filter what the log method should output to stdout.
- Source:
Examples
// a.js
const debug = require('catlog')('foo:bar');
debug('hello, world');
// DEBUG=foo:bar node a.js
Without proper `DEBUG` env, all debug logs won't show. `DEBUG` env will be matched against the log topic, `foo:bar` in the example above.
Wildcard can be used to filter messages with a group of topics.
//b.js
const debug = require('catlog')('foo:cow');
//load a.js in the previous example
require('./a');
debug('i am in b.js');
//DEBUG=foo:* node b.js will output messages from both files