mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 23:33:29 +02:00
+ add event to retrieve the logged messages in addition to writing them to the backend
git-svn-id: trunk@48459 -
This commit is contained in:
parent
dc48872552
commit
91050f14b6
@ -26,6 +26,7 @@ Type
|
|||||||
TLogType = (ltSystem,ltFile,ltStdOut,ltStdErr);
|
TLogType = (ltSystem,ltFile,ltStdOut,ltStdErr);
|
||||||
TLogCodeEvent = Procedure (Sender : TObject; Var Code : DWord) of Object;
|
TLogCodeEvent = Procedure (Sender : TObject; Var Code : DWord) of Object;
|
||||||
TLogCategoryEvent = Procedure (Sender : TObject; Var Code : Word) of Object;
|
TLogCategoryEvent = Procedure (Sender : TObject; Var Code : Word) of Object;
|
||||||
|
TLogMessageEvent = Procedure (Sender : TObject; EventType : TEventType; Const Msg : String) of Object;
|
||||||
|
|
||||||
TEventLog = Class(TComponent)
|
TEventLog = Class(TComponent)
|
||||||
Private
|
Private
|
||||||
@ -44,6 +45,7 @@ Type
|
|||||||
FOnGetCustomCategory : TLogCategoryEvent;
|
FOnGetCustomCategory : TLogCategoryEvent;
|
||||||
FOnGetCustomEventID : TLogCodeEvent;
|
FOnGetCustomEventID : TLogCodeEvent;
|
||||||
FOnGetCustomEvent : TLogCodeEvent;
|
FOnGetCustomEvent : TLogCodeEvent;
|
||||||
|
FOnLogMessage: TLogMessageEvent;
|
||||||
FPaused : Boolean;
|
FPaused : Boolean;
|
||||||
procedure SetActive(const Value: Boolean);
|
procedure SetActive(const Value: Boolean);
|
||||||
procedure SetIdentification(const Value: String);
|
procedure SetIdentification(const Value: String);
|
||||||
@ -65,6 +67,7 @@ Type
|
|||||||
Procedure DoGetCustomEventID(Var Code : DWord);
|
Procedure DoGetCustomEventID(Var Code : DWord);
|
||||||
Procedure DoGetCustomEventCategory(Var Code : Word);
|
Procedure DoGetCustomEventCategory(Var Code : Word);
|
||||||
Procedure DoGetCustomEvent(Var Code : DWord);
|
Procedure DoGetCustomEvent(Var Code : DWord);
|
||||||
|
Procedure DoLogMessage(EventType : TEventType; const Msg: String);
|
||||||
Protected
|
Protected
|
||||||
Procedure CheckInactive;
|
Procedure CheckInactive;
|
||||||
Procedure EnsureActive;
|
Procedure EnsureActive;
|
||||||
@ -104,6 +107,7 @@ Type
|
|||||||
Property OnGetCustomCategory : TLogCategoryEvent Read FOnGetCustomCategory Write FOnGetCustomCategory;
|
Property OnGetCustomCategory : TLogCategoryEvent Read FOnGetCustomCategory Write FOnGetCustomCategory;
|
||||||
Property OnGetCustomEventID : TLogCodeEvent Read FOnGetCustomEventID Write FOnGetCustomEventID;
|
Property OnGetCustomEventID : TLogCodeEvent Read FOnGetCustomEventID Write FOnGetCustomEventID;
|
||||||
Property OnGetCustomEvent : TLogCodeEvent Read FOnGetCustomEvent Write FOnGetCustomEvent;
|
Property OnGetCustomEvent : TLogCodeEvent Read FOnGetCustomEvent Write FOnGetCustomEvent;
|
||||||
|
Property OnLogMessage : TLogMessageEvent read FOnLogMessage write FOnLogMessage;
|
||||||
Property Paused : Boolean Read FPaused Write FPaused;
|
Property Paused : Boolean Read FPaused Write FPaused;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -209,6 +213,7 @@ begin
|
|||||||
ltStdOut : WriteIOLog(EventType,Msg,StdOut);
|
ltStdOut : WriteIOLog(EventType,Msg,StdOut);
|
||||||
ltStdErr : WriteIOLog(EventType,Msg,StdErr);
|
ltStdErr : WriteIOLog(EventType,Msg,StdErr);
|
||||||
end;
|
end;
|
||||||
|
DoLogMessage(EventType, Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TEventLog.FormatLogMessage(EventType : TEventType; const Msg: String): String;
|
function TEventLog.FormatLogMessage(EventType : TEventType; const Msg: String): String;
|
||||||
@ -396,6 +401,13 @@ begin
|
|||||||
FOnGetCustomEvent(Self,Code);
|
FOnGetCustomEvent(Self,Code);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TEventLog.DoLogMessage(EventType : TEventType; const Msg: String);
|
||||||
|
|
||||||
|
begin
|
||||||
|
If Assigned(FOnLogMessage) then
|
||||||
|
FOnLogMessage(Self,EventType,Msg);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TEventLog.Destroy;
|
destructor TEventLog.Destroy;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user