Format-neutral building blocks of the DragoAnt observers — mask tags, paths, name tests, results, options, value and comment policies, and the masking strategy — so that one strategy or policy works for JSON today and for CSV and YAML next.
| Package | Targets | What |
|---|---|---|
| DragoAnt.Observer.Abstractions | netstandard2.0 |
MaskKind, MaskTag — no dependencies, for model libraries |
| DragoAnt.Observer.Core | net8.0, net10.0 |
options, strategy, policies, results, paths, name tests |
You usually reference a format package instead, which brings Core: DragoAnt.System.Text.Json.Observer for JSON.
- One strategy for every format —
ValueMaskStrategy.Mask(in MaskContext, MaskValueWriter)sees the whole value, its kind, the tag, the path and its position, and writes through a format's writer, which validates numbers. - The hash of Microsoft's
HmacRedactor—MaskKind.Hashwrites the same text for the same key and key id, so hashes correlate with logs redacted by Microsoft.Extensions.Compliance.Redaction (hashing). - Policies as values —
ValuePolicy.AllowList/BlockList/NullList/Tagged(tag)for unmatched values, andCommentPolicywith comment rules for comments (comments). - Results that say why —
MaskResultwithMaskStatusandMaskFlags(InputTruncated,OutputCapped,ValueCut,TrailingData,InvalidUtf8Replaced,Depth). - Allocation-free paths and name tests —
DataPathkeeps names as UTF-8 and formats into a span;Namestests compare UTF-8 bytes and follow one case option.
dotnet add package DragoAnt.Observer.Coreusing DragoAnt.Observer;
var options = new ObserverOptions { MaxValueBytes = 256, HashKeyId = 7 };
Console.WriteLine(ValuePolicy.Tagged(MaskTag.Hash));
Console.WriteLine(MaskTag.Custom("email"));
Console.WriteLine(options.Comments);
// Tagged(Hash)
// Custom (email)
// AllowListSee CONTRIBUTING.md; report vulnerabilities as described in SECURITY.md. Licensed under the MIT licence.
Hand-written, extended with AI.