Auto set the release stage

Set the release stage to dev if we are compiled with DEBUG on, or if the
debugger is attached - else default to production.
Out of interest - what is missing in release mode? Is the stack trace completely useless in that case?