Safely log in development environments

( function( window, document, $, undefined ) {
    'use strict';

    // http://www.paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
    var log = function() {
        log.history = log.history || []; // store logs to an array for reference
        log.history.push( arguments );
        if ( window.environment && ( [2,3,4].indexOf( window.environment ) > -1 ) && window.console ) {
            window.console.log( Array.prototype.slice.call( arguments ) );
        }
    };

    // log our enviroment variable key
    log( window.enviroment );

    // ... the rest of our script

} ) ( window, document, jQuery );