Changeset 13140

Show
Ignore:
Timestamp:
03/19/08 01:42:03 (5 months ago)
Author:
alex
Message:

make the bootstrap use built-in console.log if there is one in order to print out debugging output. Useful on Safari and Opera. Refs #6255

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/_loader/bootstrap.js

    r13121 r13140  
    7575(function(){ 
    7676        // firebug stubs 
    77         if((!this["console"])||(!console["firebug"])){ 
     77 
     78        // if((!this["console"])||(!console["firebug"])){ 
     79 
     80        if(!this["console"]){ 
    7881                this.console = {}; 
    7982        } 
     
    8184        var cn = [ 
    8285                "assert", "count", "debug", "dir", "dirxml", "error", "group", 
    83                 "groupEnd", "info", "log", "profile", "profileEnd", "time", 
    84                 "timeEnd", "trace", "warn" 
     86                "groupEnd", "info", "profile", "profileEnd", "time", "timeEnd", 
     87                "trace", "warn", "log"  
    8588        ]; 
     89        if(!console["log"]){ // some browsers don't have full firebug bug give us console.log. Use it if we can. Refs #6255 
     90                console.log = function(){}; // no-op 
     91        } 
    8692        var i=0, tn; 
    8793        while((tn=cn[i++])){ 
    8894                if(!console[tn]){ 
    89                         console[tn] = function(){}; 
     95                        (function(){ 
     96                                var tcn = tn+""; 
     97                                console[tcn] = function(){  
     98                                        var a = Array.apply({}, arguments); 
     99                                        a.unshift(tcn+":"); 
     100                                        console.log(a.join(" ")); 
     101                                } 
     102                        })(); 
    90103                } 
    91104        }