Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.41 KB

logging.md

File metadata and controls

63 lines (51 loc) · 1.41 KB

docs - API - CLI - REPL - logging - arguments

logging

All callbacks passed to Gulp.create

  • onHandleStart
  • onHandleError
  • onHandleEnd
  • onStackEnd

are used to internally to produce logging.

They can also be overridden at:

Example:

var MyGulp = require('gulp-runtime').createCLass({
  onHandleEnd: function (task) {
    console.log('end', task.label);
  },
  onHandleStart: function (task) {
    console.log('start', task.label);
  },
  onHandleError: function (error, task, stack) {
    console.log('error!', task.label);
    throw error;
  }
});

var myGulp = MyGulp.create({
  onHandleStart: function (task) {
    console.log(task.label, 'ended!');
  }
});

myGulp.task(':name', function (done) {
  if (this.params && this.params.name === 'three') {
    throw new Error('ups, something broke');
  } else {
    setTimeout(done, 1000);
  }
});

myGulp.stack('one', 'two', 'three', {
  onHandleError: function (error, task, stack) {
    console.log(task.label, 'is dead');
    console.log(error);
  }
})();

Back to top ↑