Forum > Options

How to use the Event Log?

<< < (4/4)

piola:
In case others want to use this combination (Application.Log to the event log window), too: As a workaround, one can use:


--- Code: ---uses
  {$ifdef mswindows}Windows,{$endif}
  Forms,
  SysUtils;

{$modeswitch typehelpers}

type TApplicationHelper = type helper for TApplication
  procedure Log (EventType: TEventType; const Msg: String);
  procedure Log (EventType: TEventType; const Fmt: String; const Args: array of const);
end;

procedure TApplicationHelper.Log (EventType: TEventType; const Msg: String);
  begin
    {$ifdef debug} // whatsoever
    {$ifdef mswindows}
    OutputDebugString (PAnsiChar(Msg));
    {$endif}
    {$endif}
  end;

procedure TApplicationHelper.Log (EventType: TEventType; const Fmt: String; const Args: array of const);
  begin
    Log (EventType, Format (Fmt, Args));
  end;

--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version