RandomClear icon

How to redefine BugID ("uniqueness")

RandomClear | PRO | 10/02/14 02:52:52 PM UTC | 0 ⭐ | 9054 👁️ | Never ⏰ | []
Delphi |

2.05 KB

|

None

|

0 👍

/

0 👎

// BugID is used to define "unique" bug report. 
// See: http://www.eurekalog.com/help/eurekalog/bug_id.php
// Two reports with the same BugID is considered to be the same report.
// All reports with the same BugID will be merged into one, increasing "Count"/"Occurencies" field.
// This behaviour affects local bug reports (unless you have "Do not save duplicate errors" option unchecked), EurekaLog Viewer, Bug Trackers (Mantis, JIRA, FogBugs, etc.).
// This allows you to see most "hot" bugs in your code - just by sorting all bugs on "Count"/"Occurencies" field.
// You should fix most "hot" (therefore: urgent) bugs first. 
// See: http://www.eurekalog.com/help/eurekalog/reporting.php
// You may redefine what "unique" bug report means - by altering BugID.
// You can do this via OnCustomBugID event handler.
// 16-bit ABugID is default BugID (hi-word), which includes exception type, call stack, etc.
// 16-bit ACustomBugID is custom BugID (low-word), it is 0 by default and is not used by EurekaLog.
// ABugID and ACustomBugID together establish a full 32-bit BugID.
 
uses
  EException,
  EHash,
  ESysInfo,
  EEvents;
 
initialization
 
procedure DefineCustomBugID(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo; var ABugID, ACustomBugID: Word; var ACallNextHandler: Boolean);
var
  HashSource: String;
begin
  // Select sources which will define "unique" bug report
  HashSource :=
    GetComputerName + #1 +
    GetUserName + #1 +
    GetWindowsPath + #1 +
    DateTimeToStr(Now) + #1 +
    DateTimeToStr(GetCurrentModuleCompilationDate) + #1 +
    GetEurekaLogVersion + #1;
  ACustomBugID := GetCRC16(HashSource);
end;
 
initialization
  RegisterEventCustomBugID(nil, DefineCustomBugID);
end.
 
// The example above establishes most unique ID possible: each report will be unique, there will be no merging at all.
 
// You can also redefine a full BugID (i.e. overwrite pre-generated hi-word part: ABugID). 
// For example, you may take CRC32 value from hash source.
// Then you can split 32-bit CRC32 into 16-bit ABugID and ACustomBugID.

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎