StartLogging()
Previous  Top  Next

:StartLogging() - Enable Logging to Log File.

Syntax

:StartLogging([<cLogFileName>]) --> lLogStatus  

Parameters

<cLogFileName>  
<cLogFileName> optionally specifies the (new) File Name of the Log File. The default value is the current Log File Name, which is stored in the ReadOnly instance variable :LogFile.  

Returns

This method returns the current Logging Status: .T. (TRUE) if Logging was successfully enabled or .F. (FALSE) if logging could not be enabled, and is therefore (still) disabled.  

Description

Starts and Enables Logging to the current Log File, and optionally sets a (new) Log File Name. If a Log File is already open, it will first be closed, and logging is continued to/in the new Log File.  
 
If the Log File could not be created or opened, logging is not enabled, and the method returns .F. (FALSE), otherwise .T. (TRUE) is returned.  

Example

Create a new XbZLibZip object, and start Logging to Log File "MyArchive.log". Then open an existing Zip File named "MyArchive.zip" in Test mode, which will log the complete test and its result, and then close the Zip File and the Log File. This example code does the exact same as the :SetLogFile() example code:  

oZip := XbZLibZip():New()  
oZip:StartLogging("MyArchive.log")  
oZip:Open('MyArchive.zip', XBZ_OPEN_TEST)  
oZip:Close()