Created
October 23, 2017 06:22
-
-
Save jessecogollo/e92fbda0c9f0186e564c933a135109db to your computer and use it in GitHub Desktop.
debuglog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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