Enables the dynamic audit through programming.
The report of the dynamic audit is a ".waudit" file containing the invalid or abnormal behaviors, the time-consuming operations, ... For example:
- the assertions (even if they are not active).
- the non-fatal errors not processed.
- the fatal errors (exceptions), regardless they are processed by WHEN EXCEPTION or not.
- the execution warnings regarding the anomalies of the project (exceeding the capacity of a variable, ...).
- the execution warnings regarding the performance problems (resources found on a network and not found, ...).
- the custom execution comments and warnings.
Remark: If the project corresponding to the dynamic audit is opened in the editor, the audit file can be directly opened in the editor:
- on the "Home" tab, in the "General" group, expand "Open", select "Open" and select the desired ".waudit" file.
- by performing a Drag and Drop of ".waudit" file from the file explorer to the editor.
// Enables the dynamic audit with all the options enabled
<Result> = dbgEnableAudit([<Name of audit file> [, <Options>]])
- True if the dynamic audit was started,
- False otherwise.
<Name of audit file>: Optional character string
Location and name of the audit file to create. The name and location of the audit file can be:
- fully customized.
- built using the following keywords:
|[%ExeDir%]||Directory of the executable, always filled with the "\" character. This directory is equivalent to the result of fExeDir.|
|[%Date%]||Start date of the runtime audit (YYYYMMDD format).|
|[%Time%]||Start time of runtime audit (HHMMSS format).|
|[%UserName%]||Name of the current user.|
|[%DataDir%]||Directory of the HFSQL data files specified by the user when installing the application. This directory is equivalent to the result of fDataDir.|
|[%DirUserData%]||Directory for the data of the current user of the current application. This directory is equivalent to the result of fDataDirUser.|
- the extension of the audit file is ".wdaudit".
- the name of the audit file corresponds to: "[%UserDataDir%][%ExeName%]_[%Date%]_[%Time%]".
For example: "C:\Users\Doc\AppData\Roaming\WINDEV Applications\MyApp\MyApp_20071023_130812.waudit".
Caution: If you use the dynamic string construction ("Allow "[% %]" in the strings" in the "Compilation" tab of the project description), a compilation error occurs (unknown identifier). In this case, each string must be preceded by '-%'. Example:
<Options>: Optional Integer constant (or combination of constants)
Used to configure the options of the dynamic audit:
|All the audit events are written into the dynamic audit.|
|AuditAssertion||The assertions are written into the dynamic audit.|
|AuditComment||The audit comments are written into the dynamic audit. An audit comment is written by dbgWriteCommentAudit.|
|AuditEnabled||The dynamic audit is immediately enabled.|
|AuditError||The non-fatal errors not processed are written into the dynamic audit.|
|AuditException||The fatal errors, processed by WHEN EXCEPTION or not processed, are written into the dynamic audit.|
|AuditPause||The dynamic audit is initialized but it is not immediately enabled. It can be enabled thereafter by dbgAuditStatus.|
|AuditWarningAnomaly||The execution warnings regarding the detected anomalies are written into the dynamic audit.|
|AuditWarningPerformance||The execution warnings regarding performance are registered in the dynamic audit.|
|AuditWarningUser||The custom execution warnings are written into the dynamic audit. A custom warning is triggered by dbgWriteWarningAudit.|
Operating mode of dynamic audit
- dbgEnableAudit must be called only once. Any other call to this function will have no effect.
- To temporarily enable or disable the dynamic audit, use dbgAuditStatus.
- To modify the options of the dynamic audit, use dbgAuditOption.
: The dynamic audit can also be started via the ".wx" file next to the executable. For more details, see Dynamic audit
- dbgEnableAudit can be used in a REST webservice.
- You can define any location for the audit file. In this case, keep in mind there may be permission-related issues.
Reminder: Generally, the data directory is accessible in write mode.