
- Dickey Betts
SystemLog
SystemLog Methods
| SystemLog() | Constructor for the SystemLog class with no attached file |
| SystemLog() | Constructor for the SystemLog class with an attached file, specified as a string |
| SystemLog() | Constructor for the SystemLog class with an attached file, specified as a File object |
| SetFile() | Attaches a file to the SystemLog object, with file specified as a string |
| SetFile() | Attaches a file to the SystemLog object, with file specified as a File object |
| Write() | Writes a single log record to the SystemLog object |
| Read() | Reads a single log record from the SystemLog object |
| FileIsValid() | Returns true if a file is attached to the SystemLog object and it was successfully opened |
| Close() | Manually closes the file associated with the SystemLog object |
Derived Classes
None
See Also
public method SystemLog(bool EmbedTime = false)
Parameters
EmbedTime
Embeds time before each log record if true (false by default)
Return Value
None
Description
Constructor for the SystemLog class. The optional EmbedTime argument can be used to tell the SystemLog object to insert the Date and Time before each log record. This constructor does not attach a file to the log object. The SystemLog object does not need an attached file, and the records can be extracted manually using the GetRecord() method if needed. Also, a file can be attached at a later time using the SetFile() method.
SystemLog Class
public method SystemLog(string FileName, bool EmbedTime = false)
Parameters
FileName
Name of the file to contain the log records
EmbedTime
Embeds time before each log record if true (false by default)
Return Value
None
Description
Constructor for the SystemLog class. The file specified by FileName will be created automatically by the logging system. If a local name is provided, the default directory will be used (see the aztec.file.Directory class for more details on the default directory). The file does not need to exist. The optional EmbedTime argument can be used to tell the SystemLog object to insert the Date and Time before each log record.
The details of working with the attached ASCII file, such as opening and closing the file, are handled internally by the SystemLog class. The user does not need to worry about the details.
SystemLog Class
public method SystemLog(File LogFile, bool EmbedTime = false)
Parameters
LogFile
File object to be associated with this system log object
EmbedTime
Embeds time before each log record if true (false by default)
Return Value
None
Description
Constructor for the SystemLog class. The file specified by the LogFile object will be created automatically by the logging system. The file does not need to exist beforehand. The optional EmbedTime argument can be used to tell the SystemLog object to insert the Date and Time before each log record.
The details of working with the attached ASCII file, such as opening and closing the file, are handled internally by the SystemLog class. The user does not need to worry about the details.
SystemLog Class
public method SetFile(string FileName)
Parameters
FileName
Name of the file to contain the log records
Return Value
None
Description
This method attaches the file specified by FileName to the logging system, as long as a file is not already attached. If a local name is provided, the default directory will be used (see the aztec.file.Folder class for more details on the default directory). The file does not need to exist. If records have already been written into the SystemLog object before this method is called, all those records are written into the file as a result of this method call.
The details of working with the attached ASCII file, such as opening and closing the file, are handled internally by the SystemLog class. The user does not need to worry about the details.
This method can also be used to attach a file name to the default SystemLog object (available using "Script.Log()").
SystemLog Class
public method SetFile(File LogFile)
Parameters
LogFile
File object to be associated with this system log object
Return Value
None
Description
This method attaches the file specified by the LogFile object to the logging system, as long as a file is not already attached. The file does not need to exist beforehand. If records have already been written into the SystemLog object before this method is called, all those records will be written into the file as a result of this method call.
The details of working with the attached ASCII file, such as opening and closing the file, are handled internally by the SystemLog class. The user does not need to worry about the details.
This method can also be used to attach a file name to the default SystemLog object (available using "Script.Log()").
SystemLog Class
public method<string> Write(string Record)
Parameters
Record
String to be added to the SystemLog object
Return Value
Record which was written to the SystemLog record
Description
This method writes the specified record to the SystemLog object. If the SystemLog object was created with the "EmbedTime" flag set to true, the system will insert the current date and time before the string which was passed in. This allows the user to document the exact time when the record was logged. The method returns the value of the string which was written to the log, which will include the embedded time if applicable.
SystemLog Class
public method<string> Read(int Index)
Parameters
Index
One based index of the record to be retrieved
Return Value
Returns the SystemLog record specified by Index
Description
This method reads the record specified by the one based Index which is contained in the SystemLog object. The SystemLog object keeps track of all records added to it, regardless of whether a file is attached to it or not. If the index is not valid, the method will return an empty string.
SystemLog Class
public method<bool> FileIsValid()
Parameters
None
Return Value
Returns true if the attached file is valid
Description
This method returns true if a file is attached to the SystemLog object, if it was opened successfully, and if all records written to the file were completed successfully. It returns false if there is no attached file or if an error occurred trying to access the attached file.
SystemLog Class
public method<> Close()
Parameters
None
Return Value
None
Description
This method manually closes the file that is associated with this SystemLog object, if one is attached and was already successfully opened. It also breaks the tie between the SystemLog object and the file. Any further write operations to the SystemLog object will not be written to the file. It is possible to re-associate this or any other file to this same SystemLog object after this Close operation has been performed, however.
Manually calling this method is typically not necessary, as the SystemLog class will automatically perform that type of cleanup when it closes. However, this method provides the programmer the option to close it prematurely, in case the file is needed while the program is still running, or there is some other reason to break the connection between the file and SystemLog object.
SystemLog Class