log.js 421 B

1234567891011121314151617
  1. 'use strict';
  2. function debug(logLevel, ...messages) {
  3. if (logLevel === 'debug')
  4. console.log(...messages);
  5. }
  6. function warn(logLevel, warning) {
  7. if (logLevel === 'debug' || logLevel === 'warn') {
  8. if (typeof process !== 'undefined' && process.emitWarning)
  9. process.emitWarning(warning);
  10. else
  11. console.warn(warning);
  12. }
  13. }
  14. exports.debug = debug;
  15. exports.warn = warn;