refactor(telemetry.serilog): review fixes (thread-safe redactor, bootstrap logger, minlevel ordering, test coverage)

This commit is contained in:
Joseph Doherty
2026-06-01 07:48:57 -04:00
parent 37fb84f477
commit f1240c0bd4
7 changed files with 140 additions and 48 deletions
@@ -12,8 +12,10 @@ namespace ZB.MOM.WW.Telemetry.Serilog;
/// trace-context correlation, redaction, and OTel log export) to a
/// <see cref="LoggerConfiguration"/>. Shared by <see cref="ZbSerilogExtensions.AddZbSerilog"/>
/// and unit tests so both exercise an identical enricher/sink set.
/// Internal to keep the public NuGet surface minimal; exposed to the test assembly via
/// <c>[assembly: InternalsVisibleTo("ZB.MOM.WW.Telemetry.Serilog.Tests")]</c>.
/// </summary>
public static class ZbSerilogConfig
internal static class ZbSerilogConfig
{
/// <summary>
/// Applies the shared identity enrichers — <see cref="ZbLogEnricherNames.SiteId"/> and
@@ -113,9 +115,10 @@ public static class ZbSerilogConfig
/// <summary>
/// Builds the OTLP Resource-attribute map mirroring <c>ZbResource</c>. Null/empty optional
/// attributes are omitted, matching the shared Resource's omission rules.
/// attributes are omitted, matching the shared Resource's omission rules. Internal so it can
/// be asserted by the test assembly without being part of the public NuGet API.
/// </summary>
private static IDictionary<string, object> BuildResourceAttributes(ZbTelemetryOptions options)
internal static IDictionary<string, object> BuildResourceAttributes(ZbTelemetryOptions options)
{
var attributes = new Dictionary<string, object>
{