DebugFTN()

Evaluates any number of control expressions, if a specific debug flag is set and writes the result with a time stamp to stderr followed by a new line.

Synopsis

int DebugFTN(int|string dbgFlag, expression[, expression[, ...]]);

Parameters

Parameter Meaning
dbgFlag Debug flag that must be activated in order that an output will be executed.
expression Control function to be evaluated.

Return Value

In the event of an error -1, otherwise 0.

Errors

Missing arguments.

Description

The function DebugFTN() corresponds to the function DebugFN(), but in addition it displays the time stamp.

Any number of Control expressions can be evaluated with the DebugFTN() function as with Debug(). The output is executed only then, if the entered debug flag is activated/set. You can activate a debug flag by entering the -dbg someFlagNameIInvent command on the command line when you start up the manager. The result is output to the terminal incl. time stamp, from which the calling UI manager or Control manager was started. Any number of arguments, separated by commas, can be processed, with each argument being output between square brackets '[ ]'. In contrast to Debug(), the function sets a new line after output of all the arguments.

You can suppress "DebugFTN()" entries that are still found in the scripts for the appropriate Manager with an entry "ignoreDebug = 1" in the config file under [general], [ctrl], [ui] or [event]. If no entry is added to the config file, the DebugFTN()'s are still output.

The _LINE_ constant can be used for outputting the current line number of the script. This constant is replaced by an integer constant in each script that contains the value of the current line number (e.g. DebugFTN("Line:", __LINE__);).

The format in which the DebugFTN()s are output may vary for different WinCC OA versions. The function is used for troubleshooting in Control scripts!

Example

main()
{
  /*Note: to view all debug messages displayed here, you should
  enable
  the debug flags by adding: "-dbg level1,level2,6" to the
  control manager running this script.*/
  /*The following line will display text if the debug flag -dbg
  level1 is
  added to the control manager.*/
  DebugFTN("level1", "Custom debug Level 1 is activated.");
  /*The following line will display text if the debug flag -dbg
  level2 is
  added to the control manager.*/
  DebugFTN("level2", "Custom debug Level 2 is activated.");
  /*The following line will display text if the debug flag -dbg 6
  is
  added to the control manager.*/
  DebugFTN(6, "Custom level 6 is enabled", __LINE__);
  //You can display all the expressions that Debug can:
  dyn_int dnValues = makeDynInt (1, 4, 22, 91);
  DebugFTN("level1", "here is an array", dnValues);
  //The debug flags are not case sensitive.
  DebugFTN("LevEL1", "Hello");
}

Assignment

Miscellaneous functions

Availability

UI, CTRL