You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by rb...@apache.org on 2012/02/20 22:52:10 UTC

svn commit: r1291469 - /shindig/trunk/features/src/main/javascript/features/core.log/log.js

Author: rbaxter85
Date: Mon Feb 20 21:52:10 2012
New Revision: 1291469

URL: http://svn.apache.org/viewvc?rev=1291469&view=rev
Log:
SHINDIG-1708
Make it so the internal _console var gets set the first time something is logged

Modified:
    shindig/trunk/features/src/main/javascript/features/core.log/log.js

Modified: shindig/trunk/features/src/main/javascript/features/core.log/log.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.log/log.js?rev=1291469&r1=1291468&r2=1291469&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.log/log.js (original)
+++ shindig/trunk/features/src/main/javascript/features/core.log/log.js Mon Feb 20 21:52:10 2012
@@ -93,6 +93,12 @@ gadgets.log = (function() {
  * @private
  */
   function logAtLevel(level, message) {
+    if(typeof _console === 'undefined') {
+      //Purposely set to null if there is no console that way we don't come
+      //back in here
+      _console = window.console ? window.console :
+        window.opera ? window.opera.postError : null;
+    }
     if (level < logLevelThreshold_ || !_console) {
       return;
     }
@@ -147,8 +153,7 @@ gadgets.log = (function() {
  * @private
  * @static
  */
-  var _console = window.console ? window.console :
-                       window.opera ? window.opera.postError : undefined;
+  var _console;
 
   return log;
 })();