This one was a surprise for me. It’s easy to remove all traces from code in Flash IDE. I used to believe that the flex release export (Project=>Export release build) remove both debug and traces. But it does not. Now it’s also obvious that FlashDevelop release configuration also do not remove traces from sources. Of course common user doesn’t even have any applications displaying traces, but this is still affect performance. And of course this is bad-looking.
I googled a little for a solution. No, to all appearances there is no “omit trace actions” like option in flex sdk compiler, so there are no many ways out.
The easiest way is to do search and replace for all project. Replace “trace” with “//trace”, that’s all.
Also flex has pretty strong logging framework mx.logging. Here is a little example:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init();"> <mx:Script> <![CDATA[ import mx.logging.Log; import mx.logging.ILogger; import mx.logging.LogEventLevel; import mx.logging.targets.TraceTarget; private var _log:ILogger; private var _traceTarget:TraceTarget; private function init():void { _traceTarget = new TraceTarget(); _traceTarget.filters=["*"]; _traceTarget.level = LogEventLevel.ALL; _traceTarget.includeDate = false; _traceTarget.includeTime = false; _traceTarget.includeCategory = true; _traceTarget.includeLevel = true; Log.addTarget(_traceTarget); _log = Log.getLogger("ExampleLogger"); _log.info("Your tracing like a pro!"); } ]]> </mx:Script> </mx:Application>
CONFIG::debugging { trace(counter); }
Comments
Post new comment