home *** CD-ROM | disk | FTP | other *** search
- class application.debug.Logging
- {
- var enabled;
- var logging;
- static var instance;
- function Logging()
- {
- this.enabled = false;
- this.logging = null;
- }
- static function getInstance()
- {
- if(application.debug.Logging.instance == null)
- {
- application.debug.Logging.instance = new application.debug.Logging();
- }
- return application.debug.Logging.instance;
- }
- function enableLogging()
- {
- this.enabled = true;
- this.logging = new XMLSocket();
- this.logging.connect("localhost",4445);
- this.logging.send("<appName>T-Online_CDV6_0_build_2</appName>\n");
- this.logging.send("<identify/>\n");
- }
- function addKey(keyName, color)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this.logging.send("<setKey><name>" + keyName + "</name><color>" + color + "</color></setKey>\n");
- }
- function startFoldMessage(keyName, title)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this[keyName] = new String();
- this[keyName] += "<showFoldMessage key=\'" + keyName + "\'><title>" + title + "</title><message>";
- }
- function addToFoldMessage(keyName, message)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this[keyName] += message + "\n";
- }
- function endFoldMessage(keyName)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this[keyName] += "</message></showFoldMessage>\n";
- this.logging.send(this.replaceSpecialChars(this[keyName]));
- delete this[keyName];
- }
- function showMessage(s)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this.logging.send("<showMessage>" + s + "</showMessage>\n");
- }
- function showKeyedMessage(keyName, s)
- {
- if(!this.enabled)
- {
- return undefined;
- }
- this.logging.send("<showMessage key=\'" + keyName + "\'>" + s + "</showMessage>\n");
- }
- function replaceSpecialChars(s)
- {
- s = this.replaceChars(s,"&nl;","\n");
- s = this.replaceChars(s,"&","und");
- return s;
- }
- function replaceChars(s, char, replaceString)
- {
- var _loc6_ = "searching";
- var _loc9_ = 0;
- while(_loc6_ == "searching")
- {
- var _loc5_ = s.indexOf(char,_loc9_);
- if(_loc5_ == -1)
- {
- _loc6_ = "done";
- }
- else
- {
- var _loc2_ = s.split(char);
- var _loc3_ = new String();
- var _loc1_ = 0;
- while(_loc1_ < _loc2_.length)
- {
- _loc3_ += _loc2_[_loc1_];
- if(_loc1_ != _loc2_.length - 1)
- {
- _loc3_ += replaceString;
- }
- _loc1_ = _loc1_ + 1;
- }
- s = _loc3_;
- }
- }
- return s;
- }
- }
-