using ZB.MOM.WW.Telemetry.Serilog;
namespace ZB.MOM.WW.MxGateway.Server.Diagnostics;
///
/// Adapts the static to the shared seam
/// so the telemetry RedactionEnricher masks API-key/credential material on every log event.
///
public sealed class GatewayLogRedactorSeam : ILogRedactor
{
private static readonly string[] IdentityKeys = ["ClientIdentity", "authorization", "Authorization"];
///
/// Masks API-key/credential material in known identity-bearing log properties.
///
/// The log event property dictionary to redact in place.
public void Redact(IDictionary properties)
{
ArgumentNullException.ThrowIfNull(properties);
foreach (var key in IdentityKeys)
{
if (properties.TryGetValue(key, out var value) && value is string s)
{
properties[key] = GatewayLogRedactor.RedactClientIdentity(s);
}
}
}
}