lazarus-exception-logger icon indicating copy to clipboard operation
lazarus-exception-logger copied to clipboard

Expand Functions

Open federico32 opened this issue 6 years ago • 1 comments

I made a class that inherits from TExceptionLogger to add the ability to not display the exception dialog but if you save the log in a file, be able to add the date to the file name and execute an event controlled by the application when the exception is raised. TdoOnHandleException = Procedure (Sender: TObject; E: Exception) of Object; TLX_ExceptionLogger = class(TExceptionLogger) Private FShowDialog :Boolean; FAddDateToLogFileName :Boolean; FdoOnHandleException : TdoOnHandleException; FLogFileNameBase: string; Protected procedure SaveReport; procedure doOnHandleException; Public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure LX_HandleException(Sender: TObject; E: Exception); Published Property ShowDialog:Boolean read FShowDialog Write FShowDialog; Property AddDateToLogFileName :Boolean read FAddDateToLogFileName write FAddDateToLogFileName; Property OnHandleException:TdoOnHandleException read FdoOnHandleException write FdoOnHandleException; Property LogFileNameBase: string read FLogFileNameBase write FLogFileNameBase; end; To be able to use it, you must change it in the UExceptionLogger unit TExceptionLogger = class (TComponent) from Private to Protected TExceptionLogger = class(TComponent) protected FStartTime: Cardinal; FExtraInfo: TStringList; I enclose an example of use. LXexcept.zip If you find these extra features useful, add them to the new version.

federico32 avatar Aug 16 '19 14:08 federico32

It would be grate if you make a fork, add your feature and then create Pull request, It will include your contribution into the code automatically. Can you do it?

r3code avatar Sep 06 '19 18:09 r3code