var moment = require('moment');
var Promise = require('es6-promise').Promise;

var CommitCounter = require('./commit-counter').CommitCounter;
var Target = require('./target').Target;

var Collector = function() {};

Collector.prototype.collect = function() {
  var target = new Target();
  return target.load()
  .then(function(targets) {
    return targets.reduce(function(promise, i) {
      var date = moment.utc().format('YYYY-MM-DD');
      var counter = new CommitCounter(i.user, i.repo, date);
      return promise
      .then(function() { return counter.count(); })
      .then(function() { return counter.save() })
      .then(function() {
        return new Promise(function(resolve) { setTimeout(resolve, 1000); });
      });
    }, Promise.resolve());
  })
  .catch(function(e) {
    console.error(e);
  });
};

module.exports.Collector = Collector;

@@ -287,27 +287,153 @@
 ;%0A  
-return target.load(
+console.log('collector: start');%0A  return target.load()%0A  .then(function(targets) %7B%0A    console.log('collector: loaded');%0A    return targets;%0A  %7D
 )%0A  
@@ -721,30 +721,226 @@
 () %7B
- return counter.save()
+%0A        console.log('collector: counted commits');%0A        console.log(counter);%0A      %7D)%0A      .then(function() %7B return counter.save() %7D)%0A      .then(function() %7B%0A        console.log('collector: saved count');%0A     
  %7D)%0A
@@ -1084,16 +1084,71 @@
 );%0A  %7D)%0A
+  .then(function() %7B console.log('collector: end'); %7D)%0A
   .catch

add Collector logging