A wrapper around debug if you are worried about the performance penalty of creating logging data in production mode.
const createDebug = require('harrysarson/eval-debug');
const debug = createDebug('namespace');
debug('%e', expensiveFunction);
// will log the return value of expensiveFunction().
// expensiveFunction() will not be called unless debug is enabled
Conditionally running code dependant on whether or not debugging is enabled can lead to errors in production code that disapear when you try to debug them causing everyone involved a lot of grief.
Make sure any functions used for creating logging output have no side effects.
See debug-js/debug#497.