You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/06/09 00:39:52 UTC

svn commit: r664573 - /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Author: hlship
Date: Sun Jun  8 15:39:52 2008
New Revision: 664573

URL: http://svn.apache.org/viewvc?rev=664573&view=rev
Log:
TAPESTRY-2442: When Tapestry is operating inside FireFox with Firebug enabled, it should use the Firebug logging API

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=664573&r1=664572&r2=664573&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js Sun Jun  8 15:39:52 2008
@@ -459,6 +459,26 @@
 
 Element.addMethods(Tapestry.ElementAdditions);
 
+// Look for the Firebug console API and rewrite the Tapestry.error|warn|debug methods around it.
+
+if (window.console)
+{
+    var createlog = function (log)
+    {
+        return function(message, substitutions)
+        {
+            if (substitutions != undefined)
+                message = message.interpolate(substitutions);
+
+            log.call(this, message);
+        };
+    };
+
+    Tapestry.error = createlog(window.console.error);
+    Tapestry.warn = createlog(window.console.warn);
+    Tapestry.debug = createlog(window.console.debug);
+}
+
 // Collection of field based functions related to validation. Each
 // function takes a field, a message and an optional constraint value.