mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 17:10:14 +02:00
* Applied patch from Luca Olivetti to ignore errors during logging
git-svn-id: trunk@11015 -
This commit is contained in:
parent
35c0f78642
commit
40d26841cb
@ -34,6 +34,7 @@ Type
|
||||
FLogHandle : Pointer;
|
||||
FStream : TFileStream;
|
||||
FActive: Boolean;
|
||||
FRaiseExceptionOnError: Boolean;
|
||||
FIdentification: String;
|
||||
FDefaultEventType: TEventType;
|
||||
FLogtype: TLogType;
|
||||
@ -86,6 +87,7 @@ Type
|
||||
Property Identification : String Read FIdentification Write SetIdentification;
|
||||
Property LogType : TLogType Read Flogtype Write SetlogType;
|
||||
Property Active : Boolean Read FActive write SetActive;
|
||||
Property RaiseExceptionOnError : Boolean Read FRaiseExceptionOnError Write FRaiseExceptionOnError;
|
||||
Property DefaultEventType : TEventType Read FDEfaultEventType Write FDefaultEventType;
|
||||
Property FileName : String Read FFileName Write SetFileName;
|
||||
Property TimeStampFormat : String Read FTimeStampFormat Write FTimeStampFormat;
|
||||
|
@ -30,7 +30,7 @@ Procedure TEventLog.ActivateSystemLog;
|
||||
begin
|
||||
CheckIdentification;
|
||||
FLogHandle := Pointer(OpenEventLog(Nil,Pchar(Identification)));
|
||||
If FLogHandle=Nil then
|
||||
If (FLogHandle=Nil) and FRaiseExceptionOnError then
|
||||
Raise ELogError.CreateFmt(SErrNoSysLog,[GetLastError]);
|
||||
end;
|
||||
|
||||
@ -60,7 +60,7 @@ begin
|
||||
FEventID:=MapTypeToEventID(EventType);
|
||||
FEventType:=MapTypeToEvent(EventType);
|
||||
P:=PChar(Msg);
|
||||
If Not ReportEvent(Cardinal(FLogHandle),FEventType,FCategory,FEventID,Nil,1,0,@P,Nil) then
|
||||
If Not ReportEvent(Cardinal(FLogHandle),FEventType,FCategory,FEventID,Nil,1,0,@P,Nil) and FRaiseExceptionOnError then
|
||||
begin
|
||||
I:=GetLastError;
|
||||
Raise ELogError.CreateFmt(SErrLogFailed,[I]);
|
||||
|
Loading…
Reference in New Issue
Block a user