THotLog

[ Home ]



THotLog instances

THotLog is an object. You can use as many instances as you need.

The HotLog.pas unit defines a global instance variable hLog: THotLog;:
HLog is created at application start and is freed during terminate.

If your application uses only one log file, hLog will do the job. Otherwise, you can create other instances of THotLog.

 

constructor Create;

Use it if you need more instances of THotLog. (Don't use it with hLog !)


destructor Destroy; override;

If you create new instances of THotLog, you should "free" them if no longer needed. (Don't use it with hLog !)


Procedure StartLogging;

Initialize the THotLog instance. Start the parser and writer threads and open the log file.
Can be called explicitly or is call internally by all THotlog.Add... procedures at the first use.

 

Example of use:

var anOtherLog: THotLog;

...

anOtherLog := THotLog.Create;

// Modify anOtherLog properties if needed.

// Call StartLogging before beeing able to write to the log file.
// Remember: The anOtherLog.Add... procedures will do this automated. 
anOtherLog.StartLogging;

// You can now use anOtherLog.

...

// Don't forget to free it when no longer needed
anOtherLog.Free;