define(['globals'], function(globals) {
  'use strict';

  // Wrap logging so it can be pushed to log in prod, and used safely on old browsers
  var opts = ['log', 'info', 'warn', 'error'],
      l = opts.length,
      logs = {},
      logged = [];

  function logIt(name, options) {
    logged.push([name, options, type]);
  }

  while (l--) {
    var type = l;
    logs[opts[l]] =
      (window && window.console && globals.bootstrap.env &&
        globals.bootstrap.env === 'development') ?
          console[opts[l]].bind && console[opts[l]].bind(console) :
        logIt;
  }

  if (window) window.logged = logged;

  return logs;
});

define(['globals'], function(globals) {
  'use strict';

  // Wrap logging so it can be pushed to log in prod, and used safely on old browsers
  var opts = ['log', 'info', 'warn', 'error'],
      l = opts.length,
      logs = {},
      logged = [],
      useConsole = typeof window !== 'undefined' && window.console &&
        globals.bootstrap.env && typeof Function.prototype.bind === 'function' &&
        globals.bootstrap.env === 'development';

  function logIt(name, options) {
    logged.push([name, options, type]);
  }

  while (l--) {
    var type = l;
    logs[opts[l]] = useConsole ? console[opts[l]].bind(console) : logIt;
  }

  if (typeof window !== 'undefined') window.logged = logged;

  return logs;
});

Fix potential ReferenceError in non-browser env
Fix potential ReferenceError in non-browser env

Testing for `window` would throw if undeclared.
Also, avoid repeating feature check.