Debug Service provides the following features:
Powersoft documentation recommends using the debug service only during development. There are couple of different ways to eliminate the debug service calls from the production version of the application. First one is never to instantiate the debug service in production code. IsValid() function call should be added before each call to debug service.
IF IsValid(gnv_app.inv_debug) THEN gnv_app.inv_debug.of_message("Three lines of code& to display a single message! ") END IF
Second method involves adding a special comment marking the debug code section:
//@debugstart
IF IsValid(gnv_app.inv_debug) THEN
gnv_app.inv_debug.of_message("Oh great!&
Now it takes five lines! ")
END IF
//@debugend
Later a utility can be written to remove all the code between the marker comments.
The final method takes advantage of the "conditional compile" behavior of the IF statement:
IF FALSE THEN ... The code here will be optimizes out by the compiler END IF
This behavior remains the same when the "false" literal is replaced by a constant variable.
IF CON.IB_DEVELOPMENT THEN IF IsValid(gnv_app.inv_debug) THEN gnv_app.inv_debug.of_message("Cool trick,& but it's still five @#!% lines! ") END IF END IF
Finally to satisfy our agitated programmer all of this could be encapsulated in an n_cst_appmanager function:
public function integer of_debugmsg (string as_debugmsg); IF CON.IB_DEVELOPMENT THEN IF IsValid(inv_debug) THEN return inv_debug.of_message(as_debugmsg) ELSE return -1 END IF END IF return 1
To add a debug message to the log from anywhere in the application:
gnv_app.of_debugmsg("Now that's much better!")
Contributed by PFCGuide staff, except
where noted otherwise.
PFCGuide is sponsored by Dynamic Technology Group.
The information provided is for advice only and not to be considered a contract or a
liability against Dynamic Technology Group.
Last revised: February 15, 2004 03:58 AM.