Expand Functions
federico32 opened this issue · 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.
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?