Gseos.Log
Previous  Top  Next

Log(strLogFile, strText, [wColorID=None], [byAttr=0])

Append text to a log file. The text strText is appended to the file strLogFile. The Log command can even be issued if the corresponding Log window is not open. In that case the text will be written directly to the file (a LogSave() is not necessary). If the file can't be written the function throws an IOError.

ParameterDescription     
strLogFileThe file name of the log file. You can specify a relative file name. The default extension for log files is *.log.     
strText The text to be appended to the the log file..      
wColorIDOptional, a color ID specifying the color of the text to insert. The module defines several color definitions:BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LTGRAY, GRAY, LTBLUE, LTGREEN, LTCYAN, LTRED, LTMAGENTA, YELLOW, WHITE. If not specified (None) the configured foreground color will be used.      
byAttr Optional, specifies the text attribute. One or more of the following attributes can be specified: BOLD, ITALIC, UNDERLINE. The default turns all attributes off.     

Returns
None

Comments
The color and text attributes are only displayed as long as the window is not closed. After you reopen the window all these attributes will be gone. The reason for that is that the text is stored in plain ASCII format which makes it easier for standard text editors and processing software to handle the text. The text appended to the file is not written to disk immediately. If you want to access the log file from another program you should use the LogSave() function first.

Example
Log a comment:
Gseos.Log('testprotocol.log', 'Start of test procedure A', byAttr=Gseos.BOLD)