Review this generated subscriber before it processes audit events.
Register at most once, format valid event ids with the instance prefix, ignore malformed ids, never log tokens, leave input unchanged, and remove the exact callback on stop.
JavaScript
class AuditSubscriber {
constructor(bus, prefix) {
this.bus = bus;
this.prefix = prefix;
}
handle(event) {
const id = event.id.trim();
console.log(`${this.prefix}:${id}:${event.token}`);
}
start() {
this.bus.on('audit', this.handle.bind(this));
}
stop() {
this.bus.off('audit', this.handle.bind(this));
}
}
generated code is illustrative, not from any one model