Skip to content

Commit

Permalink
feat(launcher): log how long it took each browser to capture
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Dec 7, 2013
1 parent bd7fc5f commit 8dd5436
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/launcher.js
Expand Up @@ -5,6 +5,7 @@ var baseBrowserDecoratorFactory = require('./launchers/base').decoratorFactory;
var Launcher = function(emitter, injector) {
var browsers = [];
var lastUrl;
var lastStartTime;

var getBrowserById = function(id) {
for (var i = 0; i < browsers.length; i++) {
Expand All @@ -20,6 +21,8 @@ var Launcher = function(emitter, injector) {
var browser;
var url = (lastUrl = 'http://' + hostname + ':' + port + urlRoot);

lastStartTime = Date.now();

names.forEach(function(name) {
var locals = {
id: ['value', Launcher.generateId()],
Expand Down Expand Up @@ -117,6 +120,8 @@ var Launcher = function(emitter, injector) {
browsers.forEach(function(browser) {
if (browser.id === id) {
browser.markCaptured();
log.debug('%s (id %s) captured in %d secs', browser.name, browser.id,
(Date.now() - lastStartTime) / 1000);
}
});
};
Expand Down

0 comments on commit 8dd5436

Please sign in to comment.