Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

EventLogHelper

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

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

EventLogHelper

Simple Delphi class making it easier to write to the local machine's Windows Event Log.
pascal
//----------------- 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)

pascal
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