From 0e2fd7e119d284125a936155f5d855e328b9ceaa Mon Sep 17 00:00:00 2001 From: Contra Date: Tue, 26 Nov 2013 17:55:22 -0700 Subject: [PATCH] logging color change for duration + error formatting cleanup --- index.js | 25 +++++++++++++------------ package.json | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index f4b0b4297..297b47cfd 100644 --- a/index.js +++ b/index.js @@ -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); diff --git a/package.json b/package.json index 590b37dc0..60461bbc1 100644 --- a/package.json +++ b/package.json @@ -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 (http://wearefractal.com/)", @@ -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":"*",