npx skills add ...
npx skills add codewithmukesh/dotnet-claude-kit --skill serilog
Structured logging with Serilog for .NET 10 applications. Covers two-stage bootstrap, appsettings configuration, enrichers, sinks, request logging, destructuring, and Serilog.Expressions. Load this skill when setting up Serilog, configuring log sinks, enrichers, or structured logging, or when the user mentions "Serilog", "structured logging", "log enrichment", "Seq", "LogContext", "UseSerilog", "WriteTo", "message template", "Serilog.Expressions", "request logging", "log sink", "rolling file", or "audit log".
npx skills add codewithmukesh/dotnet-claude-kit --skill serilog
AddSerilog() over UseSerilog() — Use builder.Services.AddSerilog() (the modern API) instead of builder.Host.UseSerilog(). It integrates with DI services via ReadFrom.Services(services).{PropertyName} syntax creates structured data that can be queried. String interpolation ($"...") breaks structure and allocates even when the log level is disabled.Override section uses namespace prefixes matched against SourceContext. More specific prefixes take precedence.
Replaces the multiple per-request log events from ASP.NET Core with a single summary event.
Requires .Enrich.FromLogContext() on the logger configuration.
Export Serilog events directly to any OTLP backend without the OpenTelemetry SDK:
Requires the Serilog.Expressions package.
Built into Microsoft.Extensions.Logging.Abstractions — compile-time generated, zero allocations when the level is disabled.
| Scenario | Recommendation |
|---|---|
| Application logging | Serilog with AddSerilog() and appsettings.json |
| Log storage (development) | Seq (free single-user) or Aspire Dashboard |
| Log storage (production) | Seq, Elasticsearch (Elastic sink), or OTLP backend |
| Request logging | UseSerilogRequestLogging() (replaces per-request noise) |
| Scoped properties | LogContext.PushProperty() in middleware |
| Log filtering | Serilog.Expressions for expression-based filtering |
| High-performance paths | [LoggerMessage] source generator |
| Audit trails | AuditTo (synchronous, exceptions propagate) |
| Log levels by environment | MinimumLevel.Override per namespace in appsettings |
| OpenTelemetry integration | Serilog.Sinks.OpenTelemetry (no SDK dependency) |