Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FiveGeneral Functions (continued)

5.13 Logs and Log Functions

5.13.1 Overview

Legato provides any number of input and output (I/O) methods. The choice and style of I/O can vary as much as programmers and users. However, there are several convenient ways to read and write data without having to establish a formal regiment. Logs are a convenient method of keeping and relaying data. They are also used by many high-level application functions such as validation. This section discusses how logs can be created, accessed, written, read, and displayed.

A log is basically a series of message records containing a message and associated properties. Generally, logs are displayed in the application’s Information View window:

The source of the log information can be any process, such as importing or validating. Within a script, a log is created, added to, referenced, and displayed as a “Log Object”. A Log Object does not need to be displayed in the Information View. If it is, its appearance in the Information View is determined by the program section displaying the log and the content of the data.

The Log Object has certain properties that can be controlled, such as its name or the default target file. The object also contains a series of records, each with a display string and properties such as the severity of an error or the location to which the error applies.

When working in the IDE (Integrated Development Environment), up to three logs will be created for each discrete run: Legato Errors, Legato Trace and Legato Log, which is the default log. The only log that can be directly adjusted is the Legato Log. When a script is executed from the IDE, any time messages are added to the log they will be displayed when the script ends.

 

5.13.2 Log Objects

Each discrete log, whether created or accessed by the script, is treated as a Log Object. Log Objects are created and referenced via a handle which is stored in a handle variable type. As mentioned above, the Legato engine also has a default log which is displayed when using the IDE.

If a script is called from another script, the error log and default log can be retrieved by using the GetLastDefaultLog and GetLastErrorLog functions immediately after the RunScript function.

5.13.3 Meta Data

Sometimes it is desirable to associate log information with a target file. This is particularly true when the log will eventually be displayed within the Information View. The first meta item is the target file which can be set by using the LogSetTarget function. This will associate the log with a specific file, and, if the file is not open, the Information View will open it on request. If the associated file/window is untitled obviously there will not be an associated file, so the LogSetWindow function allows a window handle to be associated. Window handles are transient and if the untitled window is closed, the association will no longer be valid. Locations and positions in the target file can be set with the LogSetPosition function. Finally, sometimes the file type may not be appropriate, for example a Data View or Forms View object’s underlying data is HTML. To get the log to open the Forms View, the LogSetFileType function allows an override of a file’s implied type and associated view.

5.13.4 Global Log Object

The application and scripts have at their disposal a Global Log Object. The global object can be filled by menu functions and other scripts to pass a log back or allow a log to be modified.

5.13.5 Log Functions