EventLogHelper icon indicating copy to clipboard operation
EventLogHelper copied to clipboard

Simple Delphi class making it easier to write to the Windows Event Log

EventLogHelper

Simple Delphi class making it easier to write to the local machine's Windows Event Log.
//----------------- EXAMPLE USAGE: ---------------------------------

uses
  EventLog;

procedure TMainForm.EventLogExampleButtonClick(Sender: TObject);
begin
  TEventLog.Source := 'My Test App Name';

  TEventLog.WriteError('This is an error.');
  TEventLog.WriteInfo('This is information.');
  TEventLog.WriteWarning('This is a warning.');
end;

Also includes a ready to use message file (More info)

and a procedure to register your event source (More info)

procedure TMainForm.RegisterEventSourceButtonClick(Sender: TObject);
begin
    // This requires admin rights. Typically called once-off during the application's installation
    TEventLog.AddEventSourceToRegistry;
end;

See also http://stackoverflow.com/questions/30229826/writing-to-the-windows-event-log-using-delphi

Tested in Delphi XE and XE7