SamLogic Internet Components - Home
ActiveX: SLLogX      (Filename: SLLOGX.OCX)


SLLogX is an ActiveX component that can be used to create and handle text log files. The log control can for example be used for storing real-time statistics or for locating errors in applications.
 
 
Properties
 
Name Type Description
Activated Boolean Activates/deactivates the log functions in this control. If this property has the value False all calling of the SLLogX methods will be ignored. If this property has the value True all methods can be used. With this property you can activate and deactivate log handling in your application in an easy way.
 
CommentPrefix String Specifies a text string that should be placed at the beginning of a comment row. The default value for this property is "// ", but you can use any prefix you want.
 
DateAtLineBegin Boolean Determines if a date stamp should be inserted at the beginning of a line with log data.
 
DateFormat String Specifies the format of dates used in the log file.
 
FileName String Specifies the filename and path to the current log file.
 
IsOpen Boolean Indicates if the log file is open or closed. If this property has the value True the log file is open for writing. 
 
LogTitle String Specifies a log title that should be added at the beginning of the log file. 
 
TimeAtLineBegin Boolean Determines if a time stamp should be inserted at the beginning of line with log data. 
 
TimeFormat String Specifies the time format used in the log file. 
 
     
 
 
Methods
 

Before you can add any rows to a log file you must open it with the Open method. When you have finished adding data to the file you must close it with the Close method. All methods, except for GetLastError, returns False if an error occurs and True if there are no errors.
 
  
Open
() As Boolean

Opens a new log file for writing. The filename of the log file is specified by the FileName property. If there is already a log file at the specified path, it's deleted.

OpenAppend () As Boolean

Opens an existing log file for writing. The filename of the log file is specified by the FileName property. If there is already a log file at the specified path, the log control continues to add data at the end of the file.

Close () As Boolean

Closes the log file.
     


AddBlankLine () As Boolean

Adds a blank line to the log file. 

AddComment (Comment As String) As Boolean

Adds a comment line to the log file. The text string specified by the CommentPrefix property is inserted at the beginning of the line.

AddLine (Line As String) As Boolean

Adds a line with text to the log file. If the DateAtLineBegin and TimeAtLineBegin properties have the value True a date and time stamp is inserted at the beginning of the line.

AddSeparatorLine () As Boolean

Adds a horizontal separator line to the log file.

AddText (Text As String) As Boolean

Adds a line with text to the log file. No prefix text is used, as with the AddLine method. 

AddWindowsVersion () As Boolean

Adds a line that informs about the Windows version the application is running in. 

GetLastError () As Long

Returns an error code for the last error that occurred in the control.
  

 
 
Example
 
' Specify a filename for the log file

SLLogX1.FileName = "C:\Windows\Test.log"
' Specify a title for the log file
SLLogX1.LogTitle = "Log File Title"
' Open the log file for writing
If SLLogX1.Open Then
   
' Add a comment to the log file
    SLLogX1.AddComment "This is a comment"
   
' Add a line with data to the log file
    SLLogX1.AddLine "This is a line with log information"
   
' Close log file
    SLLogX1.Close
End If
 
 
< Go back
   
 
SamLogic