(function() {
  var _write;

  _write = process.stdout.write;

  module.exports = {
    capture: function() {
      var logs, write;
      logs = [];
      write = process.stdout.write;
      process.stdout.write = function(str) {
        logs.push(str);
        return write.apply(this, arguments);
      };
      return {
        toString: function() {
          return logs.join("");
        },
        data: logs
      };
    },
    restore: function() {
      return process.stdout.write = _write;
    }
  };

}).call(this);
