[osflash] Logging: Sascha, Kelvin anyone...

Anthony Lee mail at tonio.com
Thu Jul 13 23:08:38 EDT 2006


Hi Guys,

I was happily using the ASDT logger class till I found Kelvin's code to
hack LuminicBox and SOS together. Very nice full object tracing, but since
SOS doesn't run in Eclipse I still like using AS Logger for basic
feedback.

So I played with both Classes for a while trying to come up with an bridge
but it was beyond me. In the end I made this clumsy hack to asdt.Log.

Forgive me masters, please show me the path.

Tony

----------------

	private function Log ()
	{
		// Singelton
		_logger = LoggerFactory.createLogger(_loggerName);

		//Setup SOS
		LogWrapper.getInstance().init();
        LogWrapper.getLog().addPublisher(new SOSLogPublisher("Log Forward"));
	}

	public static function addMessage ():Void
	{
		var instance:Log;
		if (arguments.length == 4)
		{
			arguments.splice(1, 0, Log.VERBOSE);
		}
		instance = getInstance();

		if (typeof arguments[0] == 'string' || typeof arguments[0] == 'number'
|| typeof arguments[0] == 'boolean' || arguments[0] == undefined){
			if (arguments[0] == undefined) arguments[0] = "undefined";
			arguments[0] = arguments[0].toString();
			instance.addMessageToBuffer.apply(instance, arguments);
			_root.debugOutput.text += arguments[0].toString()+"\n";
		} else {
			var args2:Array = arguments.slice(0);
			args2[0] = ">> SOS";
			instance.addMessageToBuffer.apply(instance, args2);
			LogWrapper.getLog().info(arguments[2]+" >> line::"+arguments[4]);
			LogWrapper.getLog().debug(arguments[0]);
		}
	}




More information about the osflash mailing list