Ignore:
Timestamp:
Sep 9, 2010, 1:58:30 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Podpora pro možnost ignorovat opakující se výjimky.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ExceptionLogger/UExceptionLogger.pas

    r39 r40  
    2121    StackTrace: TStackTrace;
    2222    LastException: Exception;
     23    IgnoreList: TStringList;
    2324    constructor Create(AOwner: TComponent); override;
    2425    destructor Destroy; override;
     
    5455end;
    5556
    56 
    5757{ TExceptionLogger }
    5858
     
    6060begin
    6161  inherited Create(AOwner);
     62  IgnoreList := TStringList.Create;
    6263  StackTrace := TStackTrace.Create;
    6364  MaxCallStackDepth := 20;
     
    6970begin
    7071  StackTrace.Free;
     72  IgnoreList.Free;
    7173  inherited Destroy;
    7274end;
     
    155157  Report: TStringList;
    156158begin
    157   Report := TStringList.Create;
    158   try
    159     CreateTextReport(Report);
    160     if FLogFileName <> '' then begin
    161       LogToFile(Report);
    162       LogStackTraceToFile(StackTrace);
     159  if IgnoreList.IndexOf(LastException.ClassName) = -1 then begin
     160    Report := TStringList.Create;
     161    try
     162      CreateTextReport(Report);
     163      if FLogFileName <> '' then begin
     164        LogToFile(Report);
     165        LogStackTraceToFile(StackTrace);
     166      end;
     167      ExceptionForm.MemoExceptionInfo.Lines.Assign(Report);
     168      ShowReportForm;
     169    finally
     170      Report.Free;
    163171    end;
    164     ExceptionForm.MemoExceptionInfo.Lines.Assign(Report);
    165     ShowReportForm;
    166   finally
    167     Report.Free;
     172    if ExceptionForm.CheckBoxIgnore.Checked then
     173      IgnoreList.Add(LastException.ClassName);
    168174  end;
    169175end;
Note: See TracChangeset for help on using the changeset viewer.