Option 1
Use OnCustomFileName event handler:
uses
EEvents;
procedure ControlNames(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo; const AFileType: TEurekaLogFileType; var AFileName: String; var ACallNextHandler: Boolean);
var
BugReportFileName: String;
begin
// ftSavedBugReport indicate bug report
// you can also use other values
if AFileType = ftSavedBugReport then
begin
BugReportFileName := AFileName;
// you can also change file name (AFileName) here
end;
end;
initialization
RegisterEventCustomFileName(nil, ControlNames);
end.
Option 2
Assuming you have EurekaLog's information object (e.g. event handler):
{ ... } AExceptionInfo: TEurekaExceptionInfo; { ... }
var
BugReportFileName: String;
begin
BugReportFileName := AExceptionInfo.ExpandEnvVars(AExceptionInfo.Options.OutputLogFile(''));
end;
This will give you a default file name as set in your options, ignoring any run-time customizations set by OnCustomFileName event handlers, dialogs, etc.
Option 3
Only as last resort measure - use global settings:
uses
EModules; // for CurrentEurekaLogOptions
BugReportFileName := CurrentEurekaLogOptions.ExpandEnvVars(CurrentEurekaLogOptions.OutputLogFile(''));
Note: be aware, that global code can not expand some variables (such as %BugID% - because those does not exist outside of exception processing code).
See also: