Use this handler to run any code right before sending a bug or crash report
This block is executed in the background before sending each report and could be used for attaching logs and extra data to reports, for example.
Instabug.willSendReportHandler = { report in
report.appendTag("tag1")
report.logVerbose("Verbose log.")
report.append(toConsoleLogs: "Console log statement.")
report.setUserAttribute("value", withKey: "key")
let data = "Data".data(using: .utf8)
report.addFileAttachment(with: data)
return report
}
Instabug.willSendReportHandler = ^IBGReport * _Nonnull(IBGReport * _Nonnull report) {
[report appendTag:@"tag1"];
[report logVerbose:@"Verbose log."];
[report appendToConsoleLogs:@"Console log statement"];
[report setUserAttribute:@"value" withKey:@"key"];
return report;
};
Instabug.onReportSubmitHandler(new Report.OnReportCreatedListener() {
@Override
public void onReportCreated(Report report) {
}
});
Instabug.onReportSubmitHandler{report -> }
Instabug.onReportSubmitHandler((report) => {
// Attach logs and extra data to reports.
});
//iOS
Instabug.WillSendReportHandler = (IBGReport report) =>
{
report.LogVerbose("Verbos log");
report.SetUserAttribute("User Attirbute Value", "Key");
return report;
};
//Android
Instabug.OnReportSubmitHandler(new BeforeSendingReportCallback());
public class BeforeSendingReportCallback : Java.Lang.Object, Report.IOnReportCreatedListener
{
public void OnReportCreated(Report report)
{
report.AddTag("Tag");
report.LogVerbose("Verbose Log");
report.AppendToConsoleLogs("Console Log");
report.SetUserAttribute("User Attribute Value", "Key");
}
}