EurekaLog supports sending bug reports via e-mail, HTTP, FTP and multiple bug trackers. However, it is not possible for EurekaLog to support every existing send method and bug tracker. If you want to send a bug report to some unsupported bug tracker, upload it somewhere, insert into DB or use any other unsupported send method, you have the following options:
1. | Use e-mail sending. Many bug tracker software includes feature of inserting incoming e-mail as tickets into bug tracker's database - either as integral feature or as 3rd party plugin. See for more info; |
2. | Use HTTP upload. Some bug trackers allow anonymous bug reporting, which typically includes a web-page which anyone can use to report issues. For example, "Issue Collectors" in Jira, BugzScout in Fogbugz, etc. See for more info; |
3. | Write your own sending code. See example below. |
Writing your own send engine
EurekaLog has ESend unit, which defines the TELUniversalSender class. This class has a virtual abstract SendMessage method, which you can override to perform a custom sending. For example:
uses
ESend, // for TELUniversalSender and RegisterSender
EModules, // for CurrentEurekaLogOptions
ETypes; // for constants
type
// Container for your send code.
// Use any name you want, TDBUpload is just an example.
TDBUpload = class(TELUniversalSender)
public
function SendMessage: TResponse; override;
end;
{ TDBUpload }
// This method will be called by EurekaLog to send bug report.
// Place your custom sending code here.
function TDBUpload.SendMessage: TResponse;
var
X: Integer;
begin
// Usually there is only one file (.elp), but it can be multiple files -
// it depends on your project options.
try
// Example below copies all bug reports files to a folder.
// (Again, it is a single file by default).
// You should replace this code with your actual sending code.
// THIS IS ONLY AN EXAMPLE!
ForceDirectories('N:\BugReports\' + BugID + '\');
for X := 0 to AttachedFiles.Count - 1 do
Win32Check(CopyFile(PChar(AttachedFiles[X]),
PChar('N:\BugReports\' + BugID + '\' + ExtractFileName(AttachedFiles[X])),
False));
// You can also use various properties of the sender class:
// such as BugID, Message, BugType, BugText, BugReportText, BugCallStack, BugLocation,
// BugAppVersion, StepsToReproduce, UserEMail, etc.
// You can even cast ExceptionInfo to TEurekaExceptionInfo and use all properties.
// Please note the above mentioned properties will be accessible only
// if your code is being called as part of exception processing.
// For example, if you try to call send code manually, these properties may be empty.
// Indicate that send was a success.
Finalize(Result);
FillChar(Result, SizeOf(Result), 0);
Result.SendResult := srSent;
// Optional: if your send method gets an ID of the upload,
// you can store it in the response.
// For example, if you upload bug report to a database,
// you can store InsertID (id of the new row/record) in the response.
// This ID can be used later to be displayed in the "success" message/dialog
// Result.IssueID := Int64(...); // for numeric IDs
// Result.IssueIDType := iitInteger; // should match what you put in the .IssueID field
// Result.IssueIDStr := ...; // for text IDs (aliases, display names, etc)
// To indicate a send has failed:
// Result.SendResult := srUnknownError; // or any other "error" code from TSendResult
// Optional:
// Result.ErrorCode := Integer(GetLastError); // or any other error code, if any
// Result.IssueIDType := iitWin32; // should match what you put in the .ErrorCode field
// Result.ErrorMessage := 'Unable to connect to the server'; // or any other message, if any
except
on E: EOSError do
begin
Finalize(Result);
FillChar(Result, SizeOf(Result), 0);
Result.SendResult := srUnknownError;
Result.ErrorMessage := E.Message;
Result.ErrorCode := Integer(E.ErrorCode);
Result.IssueIDType := iitWin32;
end;
on E: Exception do
begin
Finalize(Result);
FillChar(Result, SizeOf(Result), 0);
Result.SendResult := srUnknownError;
Result.ErrorMessage := E.Message;
end;
end;
end;
initialization
// Ask EurekaLog to send reports via your code
CurrentEurekaLogOptions.SenderClasses := TDBUpload.ClassName;
end.
If you are sending to an unsupported bug tracker, you may want to subclass the TELTrackerSender class from the ESendWeb unit, or the TELTrackerJSONSender from the ESendAPIJSON unit. These classes already have some auxiliary code written, so you will have to write less code. Please see any of the ESendAPI*.pas units for a sample implementation.
The sample code above is just a simple example. You will need to replace it with your actual code:
1. | Refer to documentation of your bug tracker to learn about its API; |
2. | Refer to ESendAPIxyz.pas files to learn about reference implementation in EurekaLog; |
3. | Implement API support in your bug tracker in a standalone unit (follow existing code for supported bug tracker as example); |
4. | Configure your sending method at run-time. |
See also:
Send feedback...
|
Build date: 2025-09-30
Last edited: 2025-09-30
|
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation.
We do not use your e-mail address for any other purpose.
We will remove your e-mail address from our system after the issue you are reporting has been resolved.
While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback.
After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.
Permanent link to this article: https://www.eurekalog.com/help/eurekalog/how_to_send_bug_report_via_your_own_code.php
|
|