I'm saving these recipes here so I can bookmark, and I'm sure someone else will find them useful.
I decided to convert calls to trace or my logging framework to use conditional compilation so that they won't be included when I do a production build, but are included when I do a debug build.
The Flex compiler supports this by allowing you to set a variable at compile-time, eg:
-define=CONFIG::debug,true
In your code, simply wrap the code to be conditionally compiled in curly braces, prepended with this variable, eg:
CONFIG::Debug
{
trace( 'Debug' );
}
I spent some time writing a regular expression that finds trace statements, and wraps them in this block. In plain English, start at the beginning of the line, match zero or more whitespace, the word "trace", zero or more whitespace, an open parenthesis, the rest of the line.
Search for: ^([ \t]*)(trace[ \t]*\(.*)$
Replace with: $1CONFIG::debug { $2 }
FDT's internal parser doesn't like the conditional compilation syntax, so we need to change our replacement text slightly to wrap that part in markers instructing it to ignore them.
Search for: ^([ \t]*)(trace[ \t]*\(.*)$
Replace with: $1/*FDT_IGNORE*/ CONFIG::debug /*FDT_IGNORE*/ { $2 }
The same recipe for any call to logger, eg: logger.debug, logger.info, logger.warn, etc.
Search for: ^([ \t]*)(logger\..*)$
Replace with: $1/*FDT_IGNORE*/ CONFIG::debug /*FDT_IGNORE*/ { $2 }



