index.js 757 B

12345678910111213141516171819202122232425262728
  1. var api = require('./lib/extra_api');
  2. var through = require('through2');
  3. "use strict";
  4. var disable = !!process.env.DISABLE_NOTIFIER;
  5. var fn = function (i) { return function () { return i; }; };
  6. var noopError = fn(function (err) {});
  7. var noopStream = function () { return through.obj(); };
  8. // Expose plugin
  9. module.exports = disable ? noopStream : require('./lib/notify');
  10. // Expose onError behaviour
  11. module.exports.onError = disable ? noopError : api.onError;
  12. // Disable all logging
  13. disable && api.logLevel(0);
  14. // Expose to set log level
  15. module.exports.logLevel = api.logLevel;
  16. // Expose to set new logger
  17. module.exports.logger = api.logger;
  18. // Syntactiv sugar
  19. module.exports.withReporter = disable ? fn(noopStream) : require('./lib/withReporter');