Anarchy.Toolkit.Infrastructure.Telemetry.Serilog
1.0.1
dotnet add package Anarchy.Toolkit.Infrastructure.Telemetry.Serilog --version 1.0.1
NuGet\Install-Package Anarchy.Toolkit.Infrastructure.Telemetry.Serilog -Version 1.0.1
<PackageReference Include="Anarchy.Toolkit.Infrastructure.Telemetry.Serilog" Version="1.0.1" />
<PackageVersion Include="Anarchy.Toolkit.Infrastructure.Telemetry.Serilog" Version="1.0.1" />
<PackageReference Include="Anarchy.Toolkit.Infrastructure.Telemetry.Serilog" />
paket add Anarchy.Toolkit.Infrastructure.Telemetry.Serilog --version 1.0.1
#r "nuget: Anarchy.Toolkit.Infrastructure.Telemetry.Serilog, 1.0.1"
#:package Anarchy.Toolkit.Infrastructure.Telemetry.Serilog@1.0.1
#addin nuget:?package=Anarchy.Toolkit.Infrastructure.Telemetry.Serilog&version=1.0.1
#tool nuget:?package=Anarchy.Toolkit.Infrastructure.Telemetry.Serilog&version=1.0.1
Anarchy.Toolkit.Infrastructure.Telemetry.Serilog
Optional Serilog integration for Anarchy.Toolkit.Core.Telemetry. Serilog becomes one more Microsoft logging
provider: the toolkit's instrumentation code does not change, and Core keeps no Serilog dependency.
services.AddSerilogTelemetry(logger); // application-owned logger, never disposed here
services.AddSerilogTelemetry(config => config.WriteTo.Console()); // logger owned and flushed by the container
- Registration does not clear other logging providers, registers a given logger once, and keeps existing
ICoreTelemetry,IMetricRecorderorAppTelemetryregistrations (it ends withAddCoreTelemetry()).ModuleSerilogTelemetryis the same registration as aModuleTelemetryBase. SerilogConsoleDefaultsgives composition roots that own their output (command-line tools) a readable console logger;AddSerilogConsoleTelemetry()adds it only when no logging provider is registered. Libraries never add it.SerilogTelemetry.Create(logger)builds anAppTelemetryover a Serilog logger without DI.Enrich.WithCorrelationId(correlationIdPropertyName, attemptIdPropertyName)is an opt-in enricher that reads the ambientCorrelationContext. It adds each property only when the event does not already have it (AddPropertyIfAbsent), so it never duplicates the properties a Serilog provider already took from theILogger.BeginScopescope thatInfrastructure.CorrelationIdopens. Use it for events written outside such a scope (code that setsCorrelationContext.SetCorrelationValuesdirectly); the property names default to those of the correlation package and must match what the scopes use.Enrich.WithStructuredExceptionContext()adds a structuredExceptionsproperty to events with an exception.AddTelemetryLogMetrics()opts into log-based metrics: it decorates the registeredIMetricRecorderwith aLogMetricRecorderthat also writes each metric as a log event (categoryAnarchy.Toolkit.Telemetry.Metrics) through the application's logging pipeline, for log backends that derive metrics from logs.
Metrics otherwise use the application's standard .NET metrics pipeline. This package has no AWS or vendor dependency.
Releases
See the release notes for the complete release history.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Anarchy.Toolkit.Core.Telemetry (>= 1.0.1)
- Anarchy.Toolkit.Infrastructure.CorrelationId (>= 2.0.1)
- Humanizer (>= 3.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Diagnostics (>= 10.0.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Logging (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
- Newtonsoft.Json (>= 13.0.4)
- Serilog (>= 4.4.0)
- Serilog.Extensions.Logging (>= 10.0.0)
- Serilog.Sinks.Console (>= 6.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Anarchy.Toolkit.Infrastructure.Telemetry.Serilog:
| Package | Downloads |
|---|---|
|
Anarchy.Toolkit.Automation.Build
Anarchy automation components, powered by Fallout Build: solution/test conventions, Microsoft.Testing.Platform-aware test runner, linting, layering checks, NuGet and ECR container release flows and local app runs. |
GitHub repositories
This package is not used by any popular GitHub repositories.
## Releases
### 1.0.1
- chore(build): Format package release notes property
### 1.0.0
- Added optional DI integration for a consumer-configured Serilog logger, console defaults for composition roots, a
non-DI construction path, the structured-exception and correlation-ID enrichers and opt-in log-based metrics.