You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/10/20 21:55:54 UTC
svn commit: r1187024 - in
/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5:
t5-console.js tapestry.js
Author: hlship
Date: Thu Oct 20 19:55:53 2011
New Revision: 1187024
URL: http://svn.apache.org/viewvc?rev=1187024&view=rev
Log:
TAP5-1712: Tapestry.DEBUG_ENABLED, when false (default), should prevent debugging output from being displayed, but is ignored
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js
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/t5-console.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js?rev=1187024&r1=1187023&r2=1187024&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js Thu Oct 20 19:55:53 2011
@@ -16,15 +16,15 @@ T5.define("console", function() {
// FireFox throws an exception is you reference the console when it is not enabled.
- var nativeConsoleExists = false, nativeConsole = {}, floatingConsole;
+ var nativeConsole = {}, floatingConsole;
try {
if (console) {
nativeConsole = console;
- nativeConsoleExists = true;
}
}
catch (e) {
+ // No true native console, the empty nativeConsole object will take its place.
}
function display(className, message) {
@@ -56,25 +56,12 @@ T5.define("console", function() {
return function (message) {
display(className, message);
+ // consolefn may be null when there is no native console, in which case
+ // do nothing more
consolefn && consolefn.call(console, message);
}
}
- function error(message) {
- display("t-err", message);
-
- if (nativeConsoleExists) {
- console.error(message);
-
- // Chrome doesn't automatically output a trace with the error message.
- // FireFox does.
-
- if (! Prototype.Browser.Gecko) {
- console.trace();
- }
- }
- }
-
return {
/** Time, in seconds, that floating console messages are displayed to the user. */
DURATION : 10,
@@ -82,6 +69,6 @@ T5.define("console", function() {
debug : level("t-debug", nativeConsole.debug),
info : level("t-info", nativeConsole.info),
warn : level("t-warn", nativeConsole.warn),
- error : error
+ error : level("t-err", nativeConsole.error)
};
});
\ No newline at end of file
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=1187024&r1=1187023&r2=1187024&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 Thu Oct 20 19:55:53 2011
@@ -293,9 +293,14 @@ var Tapestry = {
Tapestry.invokeLogger(message, substitutions, Tapestry.Logging.info);
},
- /** Formats and displays a debug message on the console. */
+ /**
+ * Formats and displays a debug message on the console. This function is a no-op unless Tapestry.DEBUG_ENABLED is true
+ * (which will be the case when the application is running in development mode).
+ */
debug : function(message, substitutions) {
- Tapestry.invokeLogger(message, substitutions, Tapestry.Logging.debug);
+ if (Tapestry.DEBUG_ENABLED) {
+ Tapestry.invokeLogger(message, substitutions, Tapestry.Logging.debug);
+ }
},
invokeLogger : function(message, substitutions, loggingFunction) {