Privacy and report fields
note
Looking for the previous SDK? See the 6.x report privacy page.
A single ReportHandler lets you inspect or rewrite reports before they are
uploaded. It exposes two callbacks that fire around every report — including
crashes and manual reports:
onBeforeReportCreated(Report, isTerminating, completionCallback)— runs before the report is assembled. Use it to rewrite the summary / description / severity / labels, or to drop sensitive user-entered text.onAfterReportCreated(Report, isTerminating, completionCallback)— runs after assembly. Use it to attach logs, config snapshots, or other extras.
Both callbacks must invoke completionCallback.run() to release the
pipeline — except when isTerminating == true (the process is about to
exit, e.g. unhandled crash), in which case the pipeline continues
regardless.
- Java
- Kotlin
Bugsee.setReportHandler(new ReportHandler() {
@Override
public void onBeforeReportCreated(Report report, boolean isTerminating,
Runnable completionCallback) {
report.setSummary("[" + BuildConfig.FLAVOR + "] " + report.getSummary());
// Scrub anything the user may have typed into the report form:
String desc = report.getDescription();
if (desc != null) {
report.setDescription(desc.replaceAll("\\d{16}", "[CARD]"));
}
report.setSeverity(IssueSeverity.High);
completionCallback.run();
}
@Override
public void onAfterReportCreated(Report report, boolean isTerminating,
Runnable completionCallback) {
// Write your data through the attachment's output stream
Attachment attachment = report.createAndAddAttachment("config")
.setFileName("config.json")
.setMimeType("application/json");
writeConfigSnapshot(attachment);
completionCallback.run();
}
});
Bugsee.setReportHandler(object : ReportHandler {
override fun onBeforeReportCreated(
report: Report,
isTerminating: Boolean,
completionCallback: Runnable
) {
report.summary = "[${BuildConfig.FLAVOR}] ${report.summary}"
report.description = report.description?.replace(Regex("\\d{16}"), "[CARD]")
report.severity = IssueSeverity.High
completionCallback.run()
}
override fun onAfterReportCreated(
report: Report,
isTerminating: Boolean,
completionCallback: Runnable
) {
// Write your data through the attachment's output stream
val attachment = report.createAndAddAttachment("config")
.setFileName("config.json")
.setMimeType("application/json")
writeConfigSnapshot(attachment)
completionCallback.run()
}
})
The full contract — when each callback runs, what happens during a crash, which thread you are on, the completion timeout, and how attachments work — is documented on the report handler page. This page covers only the privacy side of it.
Found an issue, typo, or wrong statement on this page? Report it now →