spotlight.js
function log() {
      var defaultCount = 2,
          console = isHostType(context, 'console') && context.console,
          document = isHostType(context, 'document') && context.document,
          phantom = isHostType(context, 'phantom') && context.phantom,
          JSON = isHostType(context, 'JSON') && _.isFunction(context.JSON && context.JSON.stringify) && context.JSON;

      // Lazy define `log`.
      log = function(type, message, value) {
        var argCount = defaultCount,
            method = 'log';

        if (type == 'error') {
          argCount = 1;
          if (isHostType(console, type)) {
            method = type;
          } else {
            message = type + ': ' + message;
          }
        }
        // Avoid logging if in debug mode and running from the CLI.
        if (!isDebug || (document && !phantom)) {
          // Because `console.log` is a host method we don't assume `apply` exists.
          if (argCount < 2) {
            if (JSON) {
              value = [JSON.stringify(value), value];
              value = value[0] == 'null' ? value[1] : value[0];
            }
            console[method](message + (type == 'error' ? '' : ' ' + value));
          } else {
            console[method](message, value);
          }
        }
      };

      // For Rhino or RingoJS.
      if (!console && !document && _.isFunction(context.print)) {
        console = { 'log': print };
      }
      // Use noop for no log support.
      if (!isHostType(console, 'log')) {
        log = function() {};
      }
      // Avoid Safari 2 crash bug when passing more than 1 argument.
      else if (console.log.length == 1) {
        defaultCount = 1;
      }
      return log.apply(null, arguments);
    }
function log() {
      var defaultCount = 2,
          console = isHostType(context, 'console') && context.console,
          document = isHostType(context, 'document') && context.document,
          phantom = isHostType(context, 'phantom') && context.phantom,
          JSON = isHostType(context, 'JSON') && _.isFunction(context.JSON && context.JSON.stringify) && context.JSON;

      // Lazy define `log`.
      log = function(type, message, value) {
        var argCount = defaultCount,
            method = 'log';

        if (type == 'error') {
          argCount = 1;
          if (isHostType(console, type)) {
            method = type;
          } else {
            message = type + ': ' + message;
          }
        }
        // Avoid logging if in debug mode and running from the CLI.
        if (!isDebug || (document && !phantom)) {
          // Because `console.log` is a host method we don't assume `apply` exists.
          if (argCount < 2) {
            if (JSON) {
              value = [JSON.stringify(value), value];
              value = value[0] == 'null' ? value[1] : value[0];
            }
            console[method](message + (type == 'error' ? '' : ' ' + value));
          } else {
            console[method](message, value);
          }
        }
      };

      // For Rhino or RingoJS.
      if (!console && !document && _.isFunction(context.print)) {
        console = { 'log': print };
      }
      // Use noop for no log support.
      if (!isHostType(console, 'log')) {
        log = function() {};
      }
      // Avoid Safari 2 crash bug when passing more than 1 argument.
      else if (console.log.length == 1) {
        defaultCount = 1;
      }
      return log.apply(null, arguments);
    }
function log ( ) { var defaultCount = 2 , console = isHostType ( context , 'console' ) && context . console , document = isHostType ( context , 'document' ) && context . document , phantom = isHostType ( context , 'phantom' ) && context . phantom , JSON = isHostType ( context , 'JSON' ) && _ . isFunction ( context . JSON && context . JSON . stringify ) && context . JSON ; // Lazy define `log`. log = function ( type , message , value ) { var argCount = defaultCount , method = 'log' ; if ( type == 'error' ) { argCount = 1 ; if ( isHostType ( console , type ) ) { method = type ; } else { message = type + ': ' + message ; } } // Avoid logging if in debug mode and running from the CLI. if ( ! isDebug || ( document && ! phantom ) ) { // Because `console.log` is a host method we don't assume `apply` exists. if ( argCount < 2 ) { if ( JSON ) { value = [ JSON . stringify ( value ) , value ] ; value = value [ 0 ] == 'null' ? value [ 1 ] : value [ 0 ] ; } console [ method ] ( message + ( type == 'error' ? '' : ' ' + value ) ) ; } else { console [ method ] ( message , value ) ; } } } ; // For Rhino or RingoJS. if ( ! console && ! document && _ . isFunction ( context . print ) ) { console = { 'log' : print } ; } // Use noop for no log support. if ( ! isHostType ( console , 'log' ) ) { log = function ( ) { } ; } // Avoid Safari 2 crash bug when passing more than 1 argument. else if ( console . log . length == 1 ) { defaultCount = 1 ; } return log . apply ( null , arguments ) ; }
Logs a message to the console.

@private
@param {string} type The log type, either "text" or "error".
@param {string} message The log message.
@param {*} value An additional value to log.
Logs a message to the console .