Configuring the API Log
To use the API log, the SetApiLog function must first be called to configure the API log.
The file path to save the API log file is specified by this function. The file path can be a full file path including the file name, or a directory path. If a directory path is specified, the file name of the API log file will be set to the default apilog.dat. The date and time that the API log file was created is appended to the file name.
The size of the buffer memory to temporarily store the API log data before saving it to file can optionally be specified by this function. If not specified, the default size of 16777216 (16MB) is allocated. Each time this function is called, the buffer memory is dynamically allocated, and any buffer memory that had been previously allocated is freed. There is no minimum size for the buffer memory, but it is recommended to use the default size. If the size of the buffer memory is too small to store the data of an API function call, that data will not be saved to the API log.
The API log options can optionally be specified with the ApiLogOptions class. If the API log options are not specified, the default options will be used. See the following table for the available options.
Option |
Array Length |
Valid Values |
Default Value |
Description |
|---|---|---|---|---|
- |
0, 8388608-1073741824 (8MB-1GB) |
536870912 (512MB) |
This option specifies the maximum size of each API log file. If this size is exceeded, a new API log file is created. The actual file size of the API log file may be slightly larger, as the new API log file is created after the maximum size is exceeded. 0 can be specified for this option, in which case the default maximum file size will be used. |
|
0, 1 |
0 |
This option specifies devices to exclude from API log collection. To exclude a device from API log collection, set the value of this option at the index equal to the device ID to 1. The device ID can be checked with functions like GetDeviceID and GetAllDevices. Also see Devices for information regarding devices. |
||
0, 1 |
0 |
This option specifies modules to exclude from API log collection. To exclude a module from API log collection, set the value of this option at the index equal to the module ID to 1. The module ID of each module is enumerated in the ModuleId enumerator. All API functions of the specified module will not be saved to the API log file. |
||
0, 1 |
0 |
This option specifies whether to collect the response data of the API function calls of each module. The response data is the data that is returned by the WMX3 engines when an API function is called, and includes the return values and error code. To collect the response data of the API function calls of a module, set the value of this option at the index equal to the module ID to 1. The module ID of each module is enumerated in the ModuleId enumerator. |
Example Code for Configuring the API Log
ApiLogOptions opt;
//Set options
//Specify the file path, but not the buffer memory size
wmxlib_Log->SetApiLog(_T("C:\\Program Files\\SoftServo\\WMX3\\apilog.dat"), &opt);