Skip to content

Instantly share code, notes, and snippets.

@jessecogollo
Created October 23, 2017 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessecogollo/e92fbda0c9f0186e564c933a135109db to your computer and use it in GitHub Desktop.
Save jessecogollo/e92fbda0c9f0186e564c933a135109db to your computer and use it in GitHub Desktop.
debuglog
'use strict';
const {
debuglog
} = require('util');
const debuglogFnFoo = debuglog('foo');
const debuglogFnBar = debuglog('bar');
const debuglogFncbfy = debuglog('cbify');
// Multiple comma-separated section names may be specified in the NODE_DEBUG environment variable.
// For example: NODE_DEBUG=foo,bar,cbify
const dl = (data) => {
debuglogFnFoo('hello from debuglog Foo');
if (data === true) {
debuglogFnFoo('data Foo', data);
} else {
debuglogFnBar('data Bar', data);
}
debuglogFnBar('Bye from debuglog Bar');
return data;
};
module.exports = {
dl
};
'use strict';
const {
dl
} = require('./modules/util');
dl(true);
dl(false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment