* patch to allow append for TEventlog, from Ido. Mantis 18355

git-svn-id: trunk@17127 -
This commit is contained in:
marco 2011-03-13 01:17:34 +00:00
parent 8e788c6fa5
commit c439d0107d

View File

@ -29,6 +29,7 @@ Type
TEventLog = Class(TComponent)
Private
fAppendContent : Boolean;
FEventIDOffset : DWord;
FLogHandle : Pointer;
FStream : TFileStream;
@ -84,6 +85,7 @@ Type
Procedure Info (const Msg : String); {$ifndef fpc }Overload;{$endif}
Procedure Info (const Fmt : String; Args : Array of const); {$ifndef fpc }Overload;{$endif}
Published
Property AppendContent : Boolean Read fAppendContent Write fAppendContent;
Property Identification : String Read FIdentification Write SetIdentification;
Property LogType : TLogType Read Flogtype Write SetlogType;
Property Active : Boolean Read FActive write SetActive;
@ -240,12 +242,19 @@ begin
end;
Procedure TEventLog.ActivateFileLog;
var
fFileFlags : Word;
begin
If (FFileName='') then
FFileName:=DefaultFileName;
// This will raise an exception if the file cannot be opened for writing !
FStream:=TFileStream.Create(FFileName,fmCreate or fmShareDenyWrite);
if fAppendContent and FileExists(FFileName) then
fFileFlags := fmOpenWrite
else
fFileFlags := fmCreate;
fFileFlags := fFileFlags or fmShareDenyWrite;
FStream:=TFileStream.Create(FFileName,fFileFlags);
end;
Procedure TEventLog.DeActivateFileLog;