I use a logger. Most of the time. But though I’m ashamed to admit it - Sometimes I go loco with traces. Sometimes I just can’t help myself, and before I know it, I have obscure messages popping up in my console from places I had forgotten existed. Usually these binges happen as I try and chase something down, and when I manage to sober up, I need some way of cleaning up quick. Before anyone finds out. Before my dirty little habit is exposed.
This little string of characters does my caretaking for me. Its a simple Regx that matches all the traces in your project.
trace\(.*?\);?
In Eclipse (FDT/FB):
- Open the search panel: Search from the menu then open the File Search tab
- Paste: trace\(.*?\);? into the Containing text: input box.
- Tick the Regular expression Checkbox over to the right.
- Make sure File name patterns input box contains the right file types for your project. For Actionscript and MXML it should look like this: *.as, *.mxml
- Click Search or Replace…
I also use this in my ANT build file for any release builds.
<replaceregexp
match="trace\(.*?\);?"
replace=""
flags="gs">
<fileset
dir="${temp.dir}"
includes="**/*.as"/>
<fileset
dir="${temp.dir}"
includes="**/*.mxml"/>
</replaceregexp>
For lots more ANT goodness check out AntFunk