You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createInnerContext.js 636B

1234567891011121314151617181920212223242526
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = function createInnerContext(options, message, messageOptional) {
  7. let messageReported = false;
  8. const childContext = {
  9. log: (() => {
  10. if(!options.log) return undefined;
  11. if(!message) return options.log;
  12. const logFunction = (msg) => {
  13. if(!messageReported) {
  14. options.log(message);
  15. messageReported = true;
  16. }
  17. options.log(" " + msg);
  18. };
  19. return logFunction;
  20. })(),
  21. stack: options.stack,
  22. missing: options.missing
  23. };
  24. return childContext;
  25. };