inspector-log.js 373 B

12345678910111213141516
  1. module.exports = inspectorLog;
  2. // black hole
  3. const nullStream = new (require('stream').Writable)();
  4. nullStream._write = () => {};
  5. /**
  6. * Outputs a `console.log()` to the Node.js Inspector console *only*.
  7. */
  8. function inspectorLog() {
  9. const stdout = console._stdout;
  10. console._stdout = nullStream;
  11. console.log.apply(console, arguments);
  12. console._stdout = stdout;
  13. }