Advertisement
RandomClear

How to redefine BugID ("uniqueness")

Oct 2nd, 2014
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.05 KB | None | 0 0
  1. // BugID is used to define "unique" bug report.
  2. // See: http://www.eurekalog.com/help/eurekalog/bug_id.php
  3. // Two reports with the same BugID is considered to be the same report.
  4. // All reports with the same BugID will be merged into one, increasing "Count"/"Occurencies" field.
  5. // This behaviour affects local bug reports (unless you have "Do not save duplicate errors" option unchecked), EurekaLog Viewer, Bug Trackers (Mantis, JIRA, FogBugs, etc.).
  6. // This allows you to see most "hot" bugs in your code - just by sorting all bugs on "Count"/"Occurencies" field.
  7. // You should fix most "hot" (therefore: urgent) bugs first.
  8. // See: http://www.eurekalog.com/help/eurekalog/reporting.php
  9. // You may redefine what "unique" bug report means - by altering BugID.
  10. // You can do this via OnCustomBugID event handler.
  11. // 16-bit ABugID is default BugID (hi-word), which includes exception type, call stack, etc.
  12. // 16-bit ACustomBugID is custom BugID (low-word), it is 0 by default and is not used by EurekaLog.
  13. // ABugID and ACustomBugID together establish a full 32-bit BugID.
  14.  
  15. uses
  16.   EException,
  17.   EHash,
  18.   ESysInfo,
  19.   EEvents;
  20.  
  21. initialization
  22.  
  23. procedure DefineCustomBugID(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo; var ABugID, ACustomBugID: Word; var ACallNextHandler: Boolean);
  24. var
  25.   HashSource: String;
  26. begin
  27.   // Select sources which will define "unique" bug report
  28.   HashSource :=
  29.     GetComputerName + #1 +
  30.     GetUserName + #1 +
  31.     GetWindowsPath + #1 +
  32.     DateTimeToStr(Now) + #1 +
  33.     DateTimeToStr(GetCurrentModuleCompilationDate) + #1 +
  34.     GetEurekaLogVersion + #1;
  35.   ACustomBugID := GetCRC16(HashSource);
  36. end;
  37.  
  38. initialization
  39.   RegisterEventCustomBugID(nil, DefineCustomBugID);
  40. end.
  41.  
  42. // The example above establishes most unique ID possible: each report will be unique, there will be no merging at all.
  43.  
  44. // You can also redefine a full BugID (i.e. overwrite pre-generated hi-word part: ABugID).
  45. // For example, you may take CRC32 value from hash source.
  46. // Then you can split 32-bit CRC32 into 16-bit ABugID and ACustomBugID.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement