Interface IAuditEnricher
Adds host-defined metadata to audit entries the toolkit writes. Register with
AddThargaAuditEnricher<T>().
public interface IAuditEnricher
Remarks
Invoked by CompositeAuditLogger for every entry that passes the audit filters, just
before the entry is dispatched to the sinks. Because that logger is a singleton and its
Log(AuditEntry) is synchronous, an enricher must be resolvable as a singleton and
must not block; read per-request state through IHttpContextAccessor, exactly as the rest of
the audit pipeline does.
Merge is add-only: keys the toolkit already set on the entry win, and the first enricher to write a given key wins over later ones. An enricher therefore augments the record; it cannot rewrite what the toolkit recorded. An enricher that throws is logged and skipped — enrichment can never fail the operation being audited.
Methods
Enrich(AuditEntry, IDictionary<string, string>)
Adds entries to metadata. entry is the entry so far
(including any toolkit-set metadata) and is read-only in effect — mutations to
metadata are the only output.
void Enrich(AuditEntry entry, IDictionary<string, string> metadata)
Parameters
entryAuditEntrymetadataIDictionary<string, string>