MonitoringSystem.Observability 1.0.0

dotnet add package MonitoringSystem.Observability --version 1.0.0
                    
NuGet\Install-Package MonitoringSystem.Observability -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MonitoringSystem.Observability" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonitoringSystem.Observability" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MonitoringSystem.Observability" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MonitoringSystem.Observability --version 1.0.0
                    
#r "nuget: MonitoringSystem.Observability, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MonitoringSystem.Observability@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MonitoringSystem.Observability&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MonitoringSystem.Observability&version=1.0.0
                    
Install as a Cake Tool

MonitoringSystem.Observability Library

This is the core observability library for .NET 8.0+ applications.

Package Contents

Configuration

  • ObservabilityOptions - Main configuration class
  • LoggingOptions - Logging-specific configuration
  • FileLoggingOptions - File sink configuration
  • SensitiveDataOptions - Sensitive data masking configuration

Enrichers

  • CorrelationIdEnricher - Adds correlation IDs to log events
  • SensitiveDataMaskingEnricher - Masks sensitive data in logs
  • ICorrelationIdProvider - Interface for correlation ID management
  • ISensitiveDataMasker - Interface for custom masking strategies

Middleware

  • CorrelationIdMiddleware - Manages correlation IDs for HTTP requests

Extensions

  • ObservabilityServiceCollectionExtensions - DI container configuration
  • ObservabilityApplicationBuilderExtensions - Middleware pipeline configuration

Usage

See the main README.md in the repository root for complete usage instructions.

Dependencies

  • Serilog.AspNetCore (8.0.3)
  • Serilog.Enrichers.Environment (3.0.1)
  • Serilog.Enrichers.Thread (4.0.0)
  • Microsoft.AspNetCore.Http.Abstractions (2.2.0)

Target Framework

  • .NET 8.0

Extensibility Points

Custom Enrichers

Implement Serilog.Core.ILogEventEnricher:

public class MyCustomEnricher : ILogEventEnricher
{
    public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
    {
        var property = propertyFactory.CreateProperty("CustomProperty", "CustomValue");
        logEvent.AddPropertyIfAbsent(property);
    }
}

// Add to configuration
loggerConfiguration.Enrich.With<MyCustomEnricher>();

Custom Sensitive Data Masker

Implement ISensitiveDataMasker:

public class MyCustomMasker : ISensitiveDataMasker
{
    public string Mask(string value)
    {
        // Custom masking logic
        return "***";
    }
}

// Register in DI
services.AddSingleton<ISensitiveDataMasker, MyCustomMasker>();

Custom Correlation ID Provider

Implement ICorrelationIdProvider:

public class MyCorrelationIdProvider : ICorrelationIdProvider
{
    public string? GetCorrelationId()
    {
        // Custom logic to retrieve correlation ID
    }

    public void SetCorrelationId(string correlationId)
    {
        // Custom logic to store correlation ID
    }
}

// Register in DI
services.AddSingleton<ICorrelationIdProvider, MyCorrelationIdProvider>();

Building

dotnet build

Testing

dotnet test

Packaging

dotnet pack -c Release
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 185 11/2/2025

Initial release with structured logging, correlation ID tracking, and sensitive data masking.