SetLogFile()
Previous  Top  Next

:SetLogFile() - Set File Name for Log File.

Syntax

:SetLogFile(<cLogFileName>,  
           [<lLogStatus>]) --> cOldLogFileName  

Parameters

<cLogFileName>  
<cLogFileName> specifies the (new) File Name of the Log File. This Log File Name is saved in the Read-Only instance variable :LogFile. The name of the Log File must be a character string that contains a valid File Name or an empty string, in which case Logging is automatically disabled.  

<lLogStatus>  
<lLogStatus> optionally specifies if Logging should be Started or Ended. The default value is the current Log Status, which means that logging will continue, if it was enabled, but will not automatically start if it was disabled. If this parameter is set to .F. (FALSE), logging is stopped if it was previously enabled. If this parameter is set to .T. (TRUE), logging to the (new) Log File is immediately started/enabled.  

Returns

This method returns the previously set Log File Name, or an empty string ("") if no Log File was previously set.  

Description

Sets the (new) Log File Name, and optionally Starts or Stops Logging. Most operations that are performed by the XbZLibZip object can be logged for later analysis to a text file. Each Log File Entry starts with a Date/Time Stamp, followed by a description of the logged task. Log Entries may contain multiple lines, and additional Log Entries can be added by using the :Write2Log() method.  
 
If a Log File is already open, it will first be closed, and logging is continued to/in the new Log File if logging is already enabled, unless it is explicitly stopped by setting the <lLogStatus> parameter to .F. (FALSE).  

Example

Create a new XbZLibZip object, and set the Log File Name to "MyArchive.log" and immediately start Logging. 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:  

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