You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/07/19 22:57:04 UTC

svn commit: r423651 - /incubator/xap/trunk/src/xap/util/LogFactory.js

Author: mturyn
Date: Wed Jul 19 15:57:03 2006
New Revision: 423651

URL: http://svn.apache.org/viewvc?rev=423651&view=rev
Log:
Added a name-escaper to bypass an IE problem with fields with "." chars in them---a kludge, but does what will eventually be done by getting Hashtable right.

Modified:
    incubator/xap/trunk/src/xap/util/LogFactory.js

Modified: incubator/xap/trunk/src/xap/util/LogFactory.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/LogFactory.js?rev=423651&r1=423650&r2=423651&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/util/LogFactory.js (original)
+++ incubator/xap/trunk/src/xap/util/LogFactory.js Wed Jul 19 15:57:03 2006
@@ -16,8 +16,8 @@
  */
 
 //Let Dojo know what to expect from this file:
-Xap.provide('xap.util.xap.util.LogFactory');
-Xap.provide('xap.util.xap.util.LogFactory.ConsoleLog');
+Xap.provide("xap.util.LogFactory");
+Xap.provide("xap.util.LogFactory.ConsoleLog");
  /**
   * @constructor
  * TODO either replace or expand this to work with some other logging 
@@ -29,7 +29,7 @@
  *
  * @author ikaplansky
  */
-xap.util.LogFactory = function(){}
+xap.util.LogFactory = function(){} ;
 
 //-----------------------------------------------------------------------
 // Class Variables.
@@ -45,18 +45,26 @@
 // Public Class Methods.
 //-----------------------------------------------------------------------
 
+xap.util.LogFactory.escapeName  = function( name ){
+	return name.split(".").join("_") ;
+}
+
+
+
+
 /**
  * Returns an instance of Log for use in logging.
- *
+ * Bypasses an IE Object problem by replacing all 
  * @param name The named instance to return.
  */
 xap.util.LogFactory.getLog = function( name ) {
-    if ( xap.util.LogFactory.s_nameToConsoleLog[name] == null ) {
-        xap.util.LogFactory.s_nameToConsoleLog[name] = new xap.util.LogFactory.ConsoleLog( name );
+	var escNom = xap.util.LogFactory.escapeName(name) ;
+    if ( ! xap.util.LogFactory.s_nameToConsoleLog[escNom] ) {
+        xap.util.LogFactory.s_nameToConsoleLog[escNom] = new xap.util.LogFactory.ConsoleLog( escNom );
     }
-    var log = xap.util.LogFactory.s_nameToConsoleLog[name];
+    var log = xap.util.LogFactory.s_nameToConsoleLog[escNom];
 	return log;
-}
+} 
 
 xap.util.LogFactory.disableLogging = function() {
 	xap.util.LogFactory.s_loggingEnabled = false;
@@ -107,7 +115,7 @@
 
 xap.util.LogFactory.ConsoleLog.prototype.exception = function ( message, throwable ) {
     this.outputErr( "Exception", message );
-    if ( throwable != null ) {
+    if ( throwable ) {
 	    this.outputErr( throwable );
     }
 }
@@ -118,7 +126,7 @@
 	if( xap.util.LogFactory.s_loggingEnabled ) {
 		var output = this.format(id, message);
 		
-		if ( xap.util.LogFactory.ConsoleLog.s_logWindow == null || xap.util.LogFactory.ConsoleLog.s_logWindow.closed ) {
+		if ( !xap.util.LogFactory.ConsoleLog.s_logWindow || xap.util.LogFactory.ConsoleLog.s_logWindow.closed ) {
 		xap.util.LogFactory.ConsoleLog.s_logWindow = window.open('',this._name );
 		xap.util.LogFactory.ConsoleLog.s_logWindow.document.open();
 		xap.util.LogFactory.ConsoleLog.s_logWindow.document.writeln("<head><title>Log</title></head><body><div id=\"log\"/></body>" );