Skip to content

Releases: jamesgober/dotnet-logging-kit

v1.0.0 — Initial Release

24 Feb 00:12

Choose a tag to compare

dotnet-logging-kit v1.0.0 Release

February 23, 2024

Welcome to v1.0.0!

We're thrilled to announce the official v1.0.0 release of dotnet-logging-kit, a production-ready structured logging library for .NET. After careful design, comprehensive testing, and extensive documentation, we're confident this is the stable foundation you've been waiting for.

This release marks the transition from development to a fully stable, production-grade API that you can build upon with confidence.

What is dotnet-logging-kit?

dotnet-logging-kit is a high-performance structured logging library built on Microsoft.Extensions.Logging. It provides:

  • Structured logging with correlation ID tracking for distributed tracing
  • Multiple output formats (JSON, PlainText) with full exception hierarchies
  • File rotation with size-based and time-based strategies
  • Log enrichment with built-in enrichers for system info and custom properties
  • Scoped context management for request-scoped properties
  • Advanced log level filtering (default, per-category, per-namespace)
  • Full async/await support with ValueTask optimization
  • Thread-safe concurrent access patterns

Whether you're building microservices, ASP.NET Core applications, or backend services, dotnet-logging-kit has you covered with production-grade reliability and performance.

Key Features

Structured Logging Framework

  • Clean abstractions with ILogFormatter, ILogSink, and ILogEnricher interfaces
  • LogEntry model capturing all logging context
  • Strongly-typed configuration with fluent builder API

Correlation ID Tracking

  • Automatic request ID propagation across async boundaries
  • AsyncLocal<T> based isolation for thread safety
  • Lock-free O(1) lookup performance
  • Essential for distributed tracing in microservices

Multiple Output Formats

  • PlainTextFormatter — Human-readable format with timestamps and exceptions
  • JsonFormatter — Structured JSON output with full exception hierarchies

Multiple Output Destinations

  • ConsoleSink — Console output with configurable formatting
  • FileSink — File output with advanced rotation:
    • Size-based rotation (configurable max file size)
    • Time-based rotation (daily, hourly, monthly)
    • Automatic backup file pruning with retention policies
    • Thread-safe concurrent writes

Log Enrichment

Built-in enrichers for common scenarios:

  • MachineNameEnricher — System information
  • EnvironmentEnricher — Environment detection
  • VersionEnricher — Assembly versioning
  • ScopeContextEnricher — Scoped properties
  • SecretSanitizationEnricher — Security hardening

Scoped Context

Manage request-scoped properties with automatic inheritance:

using (logger.BeginScope(null))
{
    ScopeContextProvider.AddPropertyToCurrentScope("UserId", userId);
    logger.LogInformation("Processing request");  // Includes UserId
}

Advanced Log Level Filtering

Flexible filtering at multiple levels:

options.SetMinimumLevel(LogLevel.Warning);
options.SetNamespaceLevel("MyApp.Services", LogLevel.Information);
options.SetCategoryLevel("MyApp.Data", LogLevel.Debug);

Installation

Install via NuGet:

dotnet add package JG.LoggingKit

Or via Package Manager Console:

Install-Package JG.LoggingKit

Quick Start

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using JG.Logging.Extensions;

var services = new ServiceCollection();

// Basic setup
services.AddStructuredLogging();

// Or with configuration
services.AddStructuredLogging(options =>
{
    options.SetMinimumLevel(LogLevel.Information);
    options.AddConsoleSink(new JsonFormatter());
    options.AddFileSink("logs", rollingInterval: RollingInterval.Day);
    options.AddStandardEnrichers();
});

var sp = services.BuildServiceProvider();
var logger = sp.GetRequiredService<ILogger<Program>>();

logger.LogInformation("Application started");

For deeper examples and production patterns, see the getting started guide.

What's New in v1.0.0

This is the official stable release with all production-ready features:

  • Complete structured logging framework
  • 2 formatters (PlainText, JSON)
  • 2 sinks (Console, File with rotation)
  • 5 enrichers (Machine, Environment, Version, Scope, Secrets)
  • Correlation ID tracking for distributed tracing
  • Scoped context management
  • Advanced log level filtering
  • Full async/await support
  • 36 comprehensive tests (100% pass rate)
  • Complete documentation and examples

Quality Metrics

Metric Value
Test Count 36 comprehensive tests
Pass Rate 100%
Compiler Warnings 0
Code Coverage All critical paths
Public API Documentation 100%

Documentation

Community & Support

License

Licensed under the Apache License 2.0. See LICENSE for details.


Ready to get started? Install from NuGet and check out the documentation.