I want to declaratively turn on and off logger for my Flex application and it seems that my usual way of determining if it’s debug mode or not works only sometimes. The code for it:
isDebugSWF = new Error().getStackTrace().search(/:[0-9]+]$/m) > -1;
Do you know a better way for it?
Edit:
I posted answer below.
The previous approach was based on great article . One of the comments suggested that in Release the stacktrace is null, so I modified it properly:
This way I can finally configure ThunderBoltAS3 logger depending on current build type.