[AccessD] Log Class part 1B

JWColby jwcolby at colbyconsulting.com
Sat Jan 6 12:14:13 CST 2007


BTW, for those of you who follow the concept of a framework, I have a
framework object which is itself a class.  I have now built a new method of
the framework object that can initialize these log files and hold them in a
collection.  Given that my apps all use the framework, syntax becomes:
    
    cfw.log("MyLogName").Init("C:\Dev\DISNEW\", "Test", "LOG", "YYYYMMDD",
"HHMMSS")
    cfw.log("MyLogName").Log "Write some test text"
    cfw.log("MyLogName").Term        'closes the log file and unloads it
from the framework collection
 
Notice that this syntax looks strikingly similar to the syntax you would use
to work with any other object such as the database object, the form object
etc.  My framework is just an object, with methods and properties.
 
The first line causes the framework (cfw) to create an instance of the log
class, initialize it with the filespec information, and store a pointer to
the log class instance in a collection for future use. The second line uses
a previously initialized log class instance to write text.  The last line
unloads the class from memory and the collection of log files available for
use.
 
Doing things "the framework way" allows me to create a ton of log files as
required.  For example:
 
'
'From inside of the ULLICO export process class I call the framework and set
up two log files.
'
    cfw.log("ULLICOExport-Error").Init(C:\Dev\DISNEW\Export\ULLICO\",
"ULLICO-Error", "ERR", "YYYYMMDD", "HHMMSS") 
    cfw.log("ULLICOExport-Data").Init(C:\Dev\DISNEW\Export\ULLICO\",
"ULLICO-Data", "DAT", "YYYYMMDD", "HHMMSS")
 
'
'From inside of the HV Export class I call the framework and set up two log
classes.
'
    cfw.log("HVExport-Error").Init(C:\Dev\DISNEW\Export\HV\", "HV-Error",
"ERR", "YYYYMMDD", "HHMMSS") 
    cfw.log("HVExport-Data").Init(C:\Dev\DISNEW\Export\HV\", "HV-Data",
"DAT", "YYYYMMDD", "HHMMSS")
 
Now I have two different processes (a ULLICO export process and a HV export
process), each using two log files.  The Error log file is used to log any
processing errors that the export process runs into.  The Data log file is
the actual data file that is being assembled by the export process.
 
BTW, It took me almost as long to write this email as it did to write the
log class and hook it into my framework.  Classes are simple to write and
use once you understand them.  A framework magnifies the effectiveness of
service classes such as this log class enormously, making them dead simple
to set up, use and tear down.  
 
That's how I do it.
 
John W. Colby
Colby Consulting
www.ColbyConsulting.com
 



More information about the AccessD mailing list