Write Message (AI Studio Core)
Synopsis
This operator simply writes the given text into the specified file (can be useful in combination with a process branch).Description
This operator simply writed the specified text into the specified file. This can be useful in combination with the ProcessBranch operator. For example, one could write the success or non-success of a process into the same file depending on the condition specified by a process branch.
Input
- input (IOObject)
Any results connected at this port are written to the specified file and then delivered without any modifications to the output port. This operator can have multiple inputs. When one input is connected, another input port becomes available which is ready to accept another input (if any). The order of inputs remains the same. The result supplied at the first input port of the Write as Text operator is available at its first output port.
Output
- input (IOObject)
The results that were given as input are passed without changing to the output through this port. It is not compulsory to attach this port to any other port, the results are written into the file even if this port is left without connections. The Write as Text operator can have multiple outputs. When one output is connected, another output port becomes available which is ready to deliver another output (if any). The order of outputs remains the same. The result connected at the first input port of the Write as Text operator is delivered through the first output port
Parameters
- fileThe path of the text file is specified here. Will be created if it does not exist. Range: filename
- textThe text which should be written into the file. Range:
- modeThis parameters allows you to control what should happen to existing files. It has the following options:
- replace: Replace any existing file content with the given text.
- append: Append the text to the end of the file.
- encodingThe encoding used for reading or writing files. Range:
Tutorial Processes
Use Write Message as a custom logger.
In this example we use the append mode of the Write Message operator to create a simple logging mechanism. The Set Macros operator is used to store the logfile path and the process name information. The Write Message operators are logging the process start and finish. In between we are delaying to get different time stamps.