-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogging.js
More file actions
36 lines (32 loc) · 820 Bytes
/
logging.js
File metadata and controls
36 lines (32 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
var MyGulp = require('../.').createClass({
onHandleEnd: function (task) {
console.log('end', task.label);
},
onHandleStart: function (task) {
console.log('start', task.label);
},
onHandleError: function (error, task, stack) {
console.log('from', stack.tree().label);
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) {
console.log(task.label, 'is dead');
console.log(error);
}
})();