Documentation
IPS_SendDebug
bool IPS_SendDebug (int $ObjectID, string $MessageName, string $Data, int $Format)
Parameters
| ObjectID | ID of the object in whose debug output the message should appear |
| MessageName | Name/title of the debug message |
| Data | Content of the debug message |
| Format | Default for the display (0 = |
Returns
If the function succeeds, it returns TRUE, otherwise FALSE.
Description
The function sends the debug message Data with the name MessageName to the debug output of the object with the ID ObjectID. This allows, for example, scripts to show their own messages in the debug window of an instance. Format specifies whether the data is displayed as text or as hex with automatic display:
| Value | Constant | Display |
|---|---|---|
| 0 | DEBUG_FORMAT_TEXT |
Text |
| 1 | DEBUG_FORMAT_BINARY |
Binary/Hex |
The message is only passed on if the forwarding of debug messages is currently active for the object (e.g. because the debug window is open in the management console or IPS_EnableDebug was called) or writing to a file is activated via IPS_EnableDebugFile. Otherwise the message is discarded. In the debug file, the data is always written both as text and as hex, regardless of Format.
Within a PHP module, the module method SendDebug is used instead, which automatically sends the message to the debug output of its own instance. IPS_SendDebug, on the other hand, can send a message to any object from any script.
If ObjectID is an object mirrored via Sync Remote, the function reports the error "Remote instances cannot be debugged". Debug messages of mirrored instances can only be displayed directly on the remote system.
Example
// Output a text message in the debug output of instance 12345
IPS_SendDebug(12345, "Script", "Value was updated", DEBUG_FORMAT_TEXT);
// Binary data which is displayed as hex in the debug window
IPS_SendDebug(12345, "Packet", "\x01\x02\xFF", DEBUG_FORMAT_BINARY);