docs - API - CLI - REPL - logging - arguments
All callbacks passed to Gulp.create
onHandleStart
onHandleError
onHandleEnd
onStackEnd
are used to internally to produce logging.
They can also be overridden at:
- class level with
Gulp.createClass
- bunlde/run level using one of the composers (
gulp.start
,gulp.series
,gulp.parallel
andgulp.stack
).
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);
}
})();