Logging fungtion with Delphi

unit Logging;

(*
  Date   : 6/9/2016
  Line ID: Mesa.d
  Purpose: Test Logging
*)

interface

procedure LogMsg(const AFilename, AMessage: string);
procedure DebugLogMsg(const AFilename, AMessage: string);

implementation

uses
  SysUtils;

procedure DebugLogMsg(const AFilename, AMessage: string);
begin
  // Open log file.
end;

procedure LogMsg(const AFilename, AMessage: string);
var
  f: TextFile;
begin

  try
    AssignFile(f, AFilename);
    if FileExists(AFilename) then
      Append(f)
    else
      ReWrite(f);

    WriteLn(f, FormatDateTime('yyyy-mm-dd hh:nn:ss', Now), ' ', AMessage);

    CloseFile(f);
  except
  end;

end;

begin

  //
end.

Comments