Privacy and console logs (7.x Beta)
This page documents the 7.x beta line. For the stable release, see the 6.x log privacy page.
Disabling log collection
Log collection can be turned off with the CaptureLogs option — see
configuration.
Sanitizing logs
7.x uses a single generic filter interface, EventFilter<T>, for both log
and network events. Return the (possibly mutated) event to keep it; return
null to drop it entirely. There is no second-argument listener callback —
the filter method is synchronous.
The event type is LogEvent (package com.bugsee.library.contracts), which
replaces the 6.x BugseeLog type.
- Java
- Kotlin
Bugsee.setLogEventFilter(log -> {
String message = log.getMessage();
if (message != null) {
// Strip tokens, redact PII, etc.
log.setMessage(message.replaceAll("token=\\S+", "token=[REDACTED]"));
}
// Return the mutated event to keep it…
return log;
// …or return null to drop it entirely:
// return null;
});
Bugsee.setLogEventFilter { log ->
log.message?.let { message ->
log.message = message.replace(Regex("token=\\S+"), "token=[REDACTED]")
}
// Return the mutated event to keep it…
log
// …or return null to drop it entirely:
// null
}
setLogFilter aliasBugsee.setLogFilter(EventFilter<LogEvent>) is kept as an alias for
setLogEventFilter(...) to smooth 6.x call-site migration. Both resolve to
the same registration.
See migration section 6 for a side-by-side of the old two-arg callback vs. the new single-method filter shape.