Skip to content

Commit 0e2fd7e

Browse files
author
Contra
committed
logging color change for duration + error formatting cleanup
1 parent a52a450 commit 0e2fd7e

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

index.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@ var util = require('util');
66
var Orchestrator = require('orchestrator');
77
var chalk = require('chalk');
88

9+
// format orchestrator errors
10+
var formatError = function(e) {
11+
if (!e.err) return e.message;
12+
if (e.err.message) return e.err.message;
13+
return JSON.stringify(e.err);
14+
};
15+
916
function Gulp(){
1017
Orchestrator.call(this);
1118
this.env = {};
19+
20+
// Logging
1221
this.on('task_start', function(e){
1322
gulp.log('Running', "'"+chalk.cyan(e.task)+"'...");
1423
});
1524
this.on('task_stop', function(e){
16-
gulp.log('Finished', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds");
25+
gulp.log('Finished', "'"+chalk.cyan(e.task)+"' in "+chalk.magenta(e.duration)+" seconds");
1726
});
27+
1828
this.on('task_err', function(e){
19-
var mess;
20-
if (e.err) {
21-
if (e.err.message) {
22-
mess = e.err.message;
23-
} else {
24-
mess = JSON.stringify(e.err);
25-
}
26-
} else {
27-
mess = e.message;
28-
}
29-
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds "+chalk.red(mess)+' ');
29+
var msg = formatError(e);
30+
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' in "+chalk.magenta(e.duration)+" seconds "+chalk.red(msg));
3031
});
3132
}
3233
util.inherits(Gulp, Orchestrator);

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"gulp",
33
"description":"The streaming build system",
4-
"version":"2.4.1",
4+
"version":"2.5.0",
55
"homepage":"http://github.com/wearefractal/gulp",
66
"repository":"git://github.com/wearefractal/gulp.git",
77
"author":"Fractal <[email protected]> (http://wearefractal.com/)",
@@ -13,17 +13,17 @@
1313
"gulp":"./bin/gulp.js"
1414
},
1515
"dependencies":{
16-
"event-stream":"3.0.16",
17-
"glob-stream":"0.1.0",
18-
"mkdirp":"0.3.5",
19-
"optimist":"0.6.0",
20-
"gulp-util":"1.0.0",
21-
"gaze":"0.4.3",
22-
"orchestrator": "0.1.0",
23-
"chalk":"0.3.0",
24-
"resolve":"0.5.1",
25-
"semver":"2.2.1",
26-
"findup-sync":"0.1.2"
16+
"event-stream":"3.0.x",
17+
"glob-stream":"0.1.x",
18+
"mkdirp":"0.3.x",
19+
"optimist":"0.6.x",
20+
"gulp-util":"1.0.x",
21+
"gaze":"0.4.x",
22+
"orchestrator": "0.1.x",
23+
"chalk":"0.3.x",
24+
"resolve":"0.6.x",
25+
"semver":"2.2.x",
26+
"findup-sync":"0.1.x"
2727
},
2828
"devDependencies":{
2929
"mocha":"*",

0 commit comments

Comments
 (0)