Promotic

Debug - method of the Pm object

Description:
Text dump into the Debug item of the INFO system.
Syntax:
Empty Debug(Variant vValue, [Variant nAttr])
Parameters:
vValue(Variant) Value that has to be dumped (it can even be 1-dimensional array)
nAttr[optional] (Variant) Attributes how to dump a text. The default value is 0.
It can be sum of the following values:
1 - Detailed information about the vValue will be dumped. This information depends on the data type of the value:
- array (Array) - all array item values will be dumped
- mapa (PmMap object) - all map values will be dumped in the form of JSON.
- object (Object) - all properties and methods of the object will be dumped
- other types - the data type and value
will be dumped
2 - Text is dumped into the "Debug2" tab. Otherwise it is dumped into the "Debug1" tab.
Note:
The Debug item is the text display, 1 text string to 1 row. The Pm.Debug method adds to this item one row of text that is in the vValue parameter.
The number of rows doesn't grow to infinity - after reaching the maximum number, the oldest rows are deleted. The maximum number of rows can be set in the "INFO system settings" configuration window.

This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.

This method is also functional in Web panels. If the method is called in Web panel, there are following limitations:
- The nAttr parameter is not taken into consideration
- The text is not written into the INFO system on the server, but is stored on the Web client. Debug texts can be displayed on client side for debug purposes:
- if Shift-Ctrl-Alt-space key is pressed in the Web panel
- or in the browser console (by pressing the F12 key open the "Developer tools" and select the Console tab)


If in the Application.ini file in section [Log] the EnableDebug item is set, then the text is also written into the Application.log file.
The advantage of such approach is the accessibility of such logs even if the application is not running.

More general way of writing items into the INFO system: see the methods Pm.InfoLogReg and Pm.InfoLogAdd.
Example1:
Text dump into the "Debug1" tab:
JavaScriptVBScriptSelect and copy to clipboard

Pm.Debug("The algorithm is executed in the time:" + Pm.CreatePmDateObject().Format("%d.%m.%Y %H:%M:%S.%T"));
Example2:
Dump of detailed information about the arr variable into the "Debug2" tab:
JavaScriptVBScriptSelect and copy to clipboard

var arr = Pm.CreatePmArray().Array1("hello", 333, 3.14);
Pm.Debug(arr, 1 + 2);
PROMOTIC 9.0.17 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- Debug
 
 
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice