Click to See Complete Forum and Search --> : Log Book


erezrave
March 28th, 2003, 08:22 AM
How can I make a class for writing to Log text file.

I need to Initialize it in the beginning of the program and close it.

every time I call the Write sub of the class I need to open and close it...

not open it in the beginning and close it in the end.
:p

Jym
April 19th, 2003, 11:21 AM
The simplest way to do it is set up Global variables

FN as String 'Make that string = "c:\directory\filename"

then when you want to open and close it you just use FN

FP as Integer 'depending on the type of file you are going to use, you can do something like that to remember the last write position to the file

coolbiz
April 21st, 2003, 10:46 PM
This is when multi-threading comes in handy. Make you LOG class work on a seperate thread that reads from a queue (this should be synchronized queue) and the thread should run at a specific interval.

The idea is to have a global queue where your app can dump the log text into and your worker thread will get data from the queue and append it into a file.

-Cool Bizs