Using the FBLogs class

The FBLogs class enables you to write logging information to a file. The FBEditor and FBRecorder classes also write to log files via the same mechanism, so their logging messages may be mixed with your own.

To start using the class:

  1. A single instance of the class should be instantiated.

  2. The event handers LogError, LogInfo and LogWarning must be defined. There is no default definition of these handlers.

  3. The Enabled property should be set to True.

 

Events are sent to the event handlers from one of two sources:

  1. Internally generated via the FBEditor, FBRecorder, FBPlayer or FBVDisk class code
    Set the EnableLogging property to True for these classes to have their internal code send a stream of messages to the event handlers.

  2. From your application code
    The methods AddError, AddInfo and AddWarning can be called from your application code to send messages to the event handlers.

 

Your event handler code should take whatever action is required with these messages, such as writing them to a log file.

Note: calls to the event handlers are asynchronous - your code should use critical sections, semaphores or some other mechanism to ensure that writes to the log file are correctly synchronized.