AR Log ActiveX Library 2.0

This library will allow you to add logging capabilities to your applications. You will also be able to: erase events ocurred to an specific date; erase events till the log has the size you want; list events ocurred after a date, till a date or both; use priorities for events; have the information stored encrypted.

History:

  • 28.03.98 Version 1.0 released.
  • 18.04.98, version 2.0: Added encryption support and error information.

Properties:

  • Code. This code is necessary for the library to work. You will find it in the ZIP file.
  • FileName. Full path of the file where you want all the information to be saved.
  • FileSize (read-only). Here you can check the size of the log file.
  • LastError. Calling this property you will get a constant that will inform you about the last error produced by the library. See 'Error Constants' for more information.
  • LastErrorDescription. Call this property to get a text description of the last error produced by the library.
  • List (Priority As enumPriorityEx, [IniDate], [EndDate]) As Collection. Use this property to get a collection with all the events that follow the rules you specify when calling the property. The collection has 'clsRec' objects, that have the following properties: dDate (full date and time when the event ocurred), Priority (0 - Low, 1 - Normal, 2 - High), sEvent (text describing the event). Examples on calling these properties are:

To get the number of events saved in the log file:
Print Log.List(All).Count

To get a collection with all the events with 'high' priority ocurred between March 24th and March 26th, 1998:
Dim MyCol As New Collection
Set MyCol = Log.List(HighEx, CDate(#3/24/98#), CDate(#3/26/98#))
(The date format may vary depending on your regional configuration)

To print all the events with their dates from this collection:
Dim N As Long
For N = 1 To MyCol.Count
Print MyCol(N).dDate & Chr(9) & MyCol(N).sEvent
Next N

  • Password. Set here the password that you want to use to encrypt the information stored by this library. Leave this property empty if you don't want to use any password.
  • UnLocked. True if you have introduced the right code to use the library. False if you haven't.

Methods:

  • Add (sEvent As String, [dDate], [Priority As enumPriority = 1]) As Boolean. This method will add an event to your log file. If you don't specify a date, it will add the actual time and date as the date. If you don't specify a priority, it will set 'Normal' (1) as the priority. The possible priorities are: Low, Normal or High, whose values are 0,1 or 2 respectively. The function returns 'True' if successful or 'False' if an error ocurres.
  • EraseEventsTillDate (dDate As Date) As Boolean. This function will erase all the events ocurred till the date specified, without including events ocurred in the specified date. Returns 'True' if successful.
  • EraseEventsTillSize (lSize As Long) As Boolean. This function will start erasing events till the size of the log file is equal or less than the size specified. It will erase events starting from the oldest ones.
  • KillLog () As Boolean. This method will kill the whole log. True if successful.

Enumerations:

This library uses two different enumerations, which enumPriority and enumPriorityEx. You use the first one when you are adding an event, or when you are consulting the objects in the collections that you receive after a search. You use the second one when you are doing a search.

  • enumPriority:

Low = 0
Normal = 1
High = 2

  • enumPriorityEx:

LowEx = 0
NormalEx = 1
HighEx = 2
All = 3

The object clsRec:

This is a class with three public properties:

  • dDate as Date
  • Priority as enumPriority
  • sEvent as String

Error constants:

The error constants that this library will put in the 'LastError' property are the following:

AR_NO_ERROR = &H0
AR_NO_FILE_SPECIFIED = &H1
AR_ERROR_IN_FILE = &H2
AR_LIBRARY_IS_LOCKED = &H3
AR_FILE_IS_EMPTY = &H4
AR_UNKNOWN_ERROR = &H5
AR_NO_SIZE_SPECIFIED = &H6

Check these constants against the 'LastError' property to know about the last error that the library produced. You can also use the 'LastErrorDescription' property to show a description about the last error.

 

(18 Kb)

© Alvaro Redondo, 1998. All Rights Reserved.
http://www.sevillaonline.com/ActiveX/