Skip to content

Commit

Permalink
use pretty-hrtime to display durations
Browse files Browse the repository at this point in the history
  • Loading branch information
robrich committed Dec 9, 2013
1 parent 6ea5bad commit be3c92c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
var util = require('util');
var Orchestrator = require('orchestrator');
var gutil = require('gulp-util');
var prettyTime = require('pretty-hrtime');

// format orchestrator errors
var formatError = function(e) {
Expand All @@ -22,14 +23,14 @@ function Gulp(){
gutil.log('Running', "'"+gutil.colors.cyan(e.task)+"'...");
});
this.on('task_stop', function(e){
var time = gutil.prettyTime(e.hrDuration[0] + (e.hrDuration[1]/1e9));
gutil.log('Finished', "'"+gutil.colors.cyan(e.task)+"'", "in", gutil.colors.magenta(time.value), time.shortUnit);
var time = prettyTime(e.hrDuration);
gutil.log('Finished', "'"+gutil.colors.cyan(e.task)+"'", "in", gutil.colors.magenta(time));
});

this.on('task_err', function(e){
var msg = formatError(e);
var time = gutil.prettyTime(e.hrDuration[0] + (e.hrDuration[1]/1e9));
gutil.log('Errored', "'"+gutil.colors.cyan(e.task)+"'", "in", gutil.colors.magenta(time.value), time.shortUnit, gutil.colors.red(msg));
var time = prettyTime(e.hrDuration);
gutil.log('Errored', "'"+gutil.colors.cyan(e.task)+"'", "in", gutil.colors.magenta(time), gutil.colors.red(msg));
});
}
util.inherits(Gulp, Orchestrator);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"orchestrator": "~0.2.0",
"resolve": "~0.6.1",
"semver": "~2.2.1",
"findup-sync": "~0.1.2"
"findup-sync": "~0.1.2",
"pretty-hrtime": "~0.2.0"
},
"devDependencies": {
"mocha": "*",
Expand Down

0 comments on commit be3c92c

Please sign in to comment.