-phase
(As of 3.1.002.03)
The phase option is used to identify whether the code is running in production, dev, or test. It affects, at the time of introduction, the !!
conditional comments that may appear in the script.
Syntax
-phase
production|
development|
test
Description
At the time of introduction, the setting is sensitive to only whether its value begins with "p" or not.
During development, it is often the case, (and advisable) to include logging statements in the script code. That might be _logf
, _logPrintf
, _tracef
, or others. They can be extremely helpful during development. However, there is a tendency to simply leave them in and hence slow down production. Or you take them out, or comment them out, and are dismayed when maintenance has to be done on the script.
As of 3.1.002.03, you can "conditionally comment" your code by starting such lines with !!
. To be effective, that must be at the very start of the line, not indented at all. As long as you are in the development phase, those !!
characters will be replaced with blanks before the code is compiled. However, if -phase
p
is provided as a command line option then the !!
characters will be replaced with //
before the code is compiled. Hence all of those logging lines will be commented out, without your physically changing any code, and yet be instantly available should any maintenance be required. This provides development efficiency and also improves production performance. Other functions like _dlogf
and _dmessage
are still useful since, unless -debug
is specified, they will avoid I/O out to the log file. Nevertheless, evaluation of their arguments will wastefully occur before the function can discover that it is not to do the actual logging.
It is expected that -phase
production will be inserted into the override $O/DocOrigin.prm
on production DocOrigin servers, but not be so specified on "dev" machines. Of course, a development person could occasionally specify
-phase
p for final testing runs. Note that these !!
conditional comments need not be applied to only logging functions. It might be that in development you would, for example, override a production output location with a stand-in for use during development. This processing applies not just to Merge but to all areas where scripting is used.