Skip to content

Commit

Permalink
logging color change for duration + error formatting cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Nov 27, 2013
1 parent a52a450 commit 0e2fd7e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
25 changes: 13 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@ var util = require('util');
var Orchestrator = require('orchestrator');
var chalk = require('chalk');

// format orchestrator errors
var formatError = function(e) {
if (!e.err) return e.message;
if (e.err.message) return e.err.message;
return JSON.stringify(e.err);
};

function Gulp(){
Orchestrator.call(this);
this.env = {};

// Logging
this.on('task_start', function(e){
gulp.log('Running', "'"+chalk.cyan(e.task)+"'...");
});
this.on('task_stop', function(e){
gulp.log('Finished', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds");
gulp.log('Finished', "'"+chalk.cyan(e.task)+"' in "+chalk.magenta(e.duration)+" seconds");
});

this.on('task_err', function(e){
var mess;
if (e.err) {
if (e.err.message) {
mess = e.err.message;
} else {
mess = JSON.stringify(e.err);
}
} else {
mess = e.message;
}
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds "+chalk.red(mess)+' ');
var msg = formatError(e);
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' in "+chalk.magenta(e.duration)+" seconds "+chalk.red(msg));
});
}
util.inherits(Gulp, Orchestrator);
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name":"gulp",
"description":"The streaming build system",
"version":"2.4.1",
"version":"2.5.0",
"homepage":"http://github.com/wearefractal/gulp",
"repository":"git://github.com/wearefractal/gulp.git",
"author":"Fractal <[email protected]> (http://wearefractal.com/)",
Expand All @@ -13,17 +13,17 @@
"gulp":"./bin/gulp.js"
},
"dependencies":{
"event-stream":"3.0.16",
"glob-stream":"0.1.0",
"mkdirp":"0.3.5",
"optimist":"0.6.0",
"gulp-util":"1.0.0",
"gaze":"0.4.3",
"orchestrator": "0.1.0",
"chalk":"0.3.0",
"resolve":"0.5.1",
"semver":"2.2.1",
"findup-sync":"0.1.2"
"event-stream":"3.0.x",
"glob-stream":"0.1.x",
"mkdirp":"0.3.x",
"optimist":"0.6.x",
"gulp-util":"1.0.x",
"gaze":"0.4.x",
"orchestrator": "0.1.x",
"chalk":"0.3.x",
"resolve":"0.6.x",
"semver":"2.2.x",
"findup-sync":"0.1.x"
},
"devDependencies":{
"mocha":"*",
Expand Down

0 comments on commit 0e2fd7e

Please sign in to comment.