Delphi component wrapper for NT event logging API


This non-visual component is a wrapper for the Windows NT event logging API. To use:

  1. Place it on a form or datamodule (you only need one event log component per project)
  2. Set the "AppName" property to a meaningful representation of your application name. This name appears in the logged message data.
  3. Call the "InitLogin" method at the start of the application - the form create is a good place. This method creates the required registry entries for event logging (if they are not present already) and initialises the event logging API.
  4. Call the methods "LogError", "LogWarning" and "LogInfo" to create event log entries at the required level of severity.

The two methods "CreateRegEntry" and "DeleteRegEntry" can be used to manually register the application for event logging in the registry and clean the registry entries up when they are no longer used (i.e. the application is uninstalled).

You can download the full Delphi source code here

Delphi Central - Delphi Programming Tutorials, Hints and Tips