unit Log;
///////////////////////////////////////
//   Unit : Log
//   Date : 01/12/2006
// Author : Amosow 'Gambit_OZ' Evgeniy
// e-Mail : greenrat@mail333.com
///////////////////////////////////////
interface

Uses
	Windows, Messages, SysUtils;

Var
	fLogFile:TextFile;

Procedure OpenLog;
Procedure CloseLog;
Procedure AddToLog(s:String;FinishLn,AddDate:Boolean);

implementation

Procedure OpenLog;
begin
  AssignFile(fLogFile,'Log.txt');
  Rewrite(fLogFile);
  WriteLn(fLogFile,'Opening Log at '+DateToStr(Date)+' '+TimeToStr(Time));
end;


Procedure CloseLog;
begin
	WriteLn(fLogFile,'Closing Log at '+DateToStr(Date)+' '+TimeToStr(Time));
	CloseFile(fLogFile);
end;


Procedure AddToLog(s:String;FinishLn,AddDate:Boolean);
begin
    If AddDate then s:=DateToStr(Date)+' '+TimeToStr(Time)+': '+s;
    If FinishLn then WriteLn(fLogFile,s) else Write(fLogFile,s);
end;

end.
