Our Products
Classes
BMP
Crypto
CSVStrings
DataLogger
Dates
DebugRecorder
FileNameSet
FileSender
RDOConnectMaster
ReportAids
Sheller
StringSet
WEBUtilities
Modules
DAOLib
Globals
Registry
Programs
Batcher
HTMLGen
KillTime
TimedMessage
|
DataLogger: This class implements a data logger.
Data logging may be controlled either via a set of properties or the [Logging] section of an INI file whose name and location are defaulted to the name and location of the using application or provided via a call to SetupINI before the first log entry is made. This means you can easily create an application whose logging can be configured without recompiling.
No need to setup the INI file; the code sets it up with default values for you with its first use. Then tailor it as needed. This will get you going quicker!
Log entries are made via a call to WriteLog.
Multiple log files are supported with optional size limits. Each new program execution can restart the log file or begin where the previous execution left off. And finally, the log may be automatically printed at the end of program execution. So you can easily retain log information for historical purposes.
We use this class to create event logs on unattended machines so that questioned transactions may be verified.
Requires Microsoft Scripting Runtime(SCRRUN.dll). To see sample use of DataLogger and its full interface definition,
scroll down. |
|
| This tiny snippet creates a DataLogger object, tells it where the home directory is and the name of the .INI file
to use for setting information, and then writes one line to the log. When that line is written, it is prefixed with the
current date and time. |
Global Log As DataLogger 'declare logging object
Set Log = New DataLogger 'create the object
Call Log.SetupIni(ThePath, IniFileName)
' tell logger where home is; name of .INI file
Call Log.WriteLog(s) 'write an entry to the log
|
| This is a portion of the .INI file for a program using DataLogger. MakeLog is set TRUE/FALSE to control whether
Logging is performed. The LogSize entry limits the size of a log file to 1 megabyte. The Cycles entry tells DataLogger to
cycle through three files (TCMDOWN1.LOG, TCMDOWN2.LOG, TCMDOWN3.LOG). FileMode is set to REWRITE/APPEND to control how
logging is started at the beginning of program execution. PrintLog is set to Y/N to control printing of the log upon
program termination. |
.
.
[Logging]
MakeLog=True
FileName=TCMDOWN.LOG
LogSize=1
Cycles=3
FileMode=REWRITE
PrintLog=N
.
.
|
| Here is the full interface definition for the DataLogger Class |
Public Function Logging() As Boolean
' TRUE if logging is active
Public Sub SetupIni(APath As String, AnIniFile As String)
' Sets MyPath=APath, MyIniFileName
Public Sub WriteLog(s As String)
' Adds s to the logging file
|
|