Muonroi.Logging.Abstractions 1.0.0-alpha.16

This is a prerelease version of Muonroi.Logging.Abstractions.
dotnet add package Muonroi.Logging.Abstractions --version 1.0.0-alpha.16
                    
NuGet\Install-Package Muonroi.Logging.Abstractions -Version 1.0.0-alpha.16
                    
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="Muonroi.Logging.Abstractions" Version="1.0.0-alpha.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Muonroi.Logging.Abstractions" Version="1.0.0-alpha.16" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.Logging.Abstractions" />
                    
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 Muonroi.Logging.Abstractions --version 1.0.0-alpha.16
                    
#r "nuget: Muonroi.Logging.Abstractions, 1.0.0-alpha.16"
                    
#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 Muonroi.Logging.Abstractions@1.0.0-alpha.16
                    
#: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=Muonroi.Logging.Abstractions&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.Logging.Abstractions&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Tool

Muonroi.Logging.Abstractions

Contracts-only package that defines the IMLog<T>, IMLogContext, and log-property conventions used across the Muonroi ecosystem.

NuGet License: Apache 2.0

This package ships the logging interfaces and property-key constants that consumer libraries depend on at compile time — no runtime behavior is included. Services that want structured logging take IMLog<T> by constructor injection; middleware and request handlers push ambient properties through IMLogContext. The concrete implementation lives in Muonroi.Logging.

Installation

dotnet add package Muonroi.Logging.Abstractions --prerelease

Quick Start

This package defines contracts only. Implement or inject IMLog<T> in your service; for tests or AOT scenarios you can supply a no-op implementation without taking a dependency on any logging provider:

using Muonroi.Logging.Abstractions;
using Microsoft.Extensions.Logging;

// Minimal no-op implementation — useful in tests or AOT hosts.
internal sealed class NoOpLog<T> : IMLog<T>
{
    private sealed class NullScope : IMLogContextScope
    {
        public static readonly NullScope Instance = new();
        public void Dispose() { }
    }

    public IMLogContextScope BeginProperty(string key, object? value) => NullScope.Instance;
    public void Info(string messageTemplate, params object?[] args) { }
    public void Warn(string messageTemplate, params object?[] args) { }
    public void Error(Exception? ex, string messageTemplate, params object?[] args) { }
    public void Debug(string messageTemplate, params object?[] args) { }
    public void InfoTrace(string messageTemplate, params object?[] args) { }

    public IDisposable? BeginScope<TState>(TState state) where TState : notnull => NullScope.Instance;
    public bool IsEnabled(LogLevel logLevel) => false;
    public void Log<TState>(LogLevel logLevel, EventId eventId, TState state,
        Exception? exception, Func<TState, Exception?, string> formatter) { }
}

// Register with open-generic DI so every IMLog<T> request is satisfied:
services.AddSingleton(typeof(IMLog<>), typeof(NoOpLog<>));

For full structured logging in an ASP.NET Core application, use AddMuonroiLogging() from Muonroi.Logging:

builder.Logging.AddMuonroiLogging();

Features

  • IMLog / IMLog<T> — structured logging interface extending ILogger / ILogger<T> with shorthand methods (Info, Warn, Error, Debug, InfoTrace) and BeginProperty scoping.
  • IMLogFactory — factory interface for creating IMLog instances by type or category name.
  • IMLogContext — ambient property bag; push key-value pairs into the logging context with PushProperty / PushProperties.
  • IMLogContextScope — disposable scope returned by BeginProperty / PushProperty; disposing it removes the property from the context.
  • LogPropertyConventions — static constants for standard structured-log property keys: TenantId, UserId, CorrelationId, TraceSessionId, RuleCode, RequestName.

API Reference

Type Purpose
IMLog Base structured-logging interface; extends ILogger. Adds Info, Warn, Error, Debug, InfoTrace, and BeginProperty.
IMLog<T> Generic variant; extends both IMLog and ILogger<T>. Inject this in application services.
IMLogFactory Creates IMLog and IMLog<T> instances by type parameter or category name string.
IMLogContext Ambient context bag. PushProperty(key, value) and PushProperties(dict) attach properties to all log events within the returned scope.
IMLogContextScope Disposable returned by BeginProperty / PushProperty. Dispose to remove the pushed property from the ambient context.
LogPropertyConventions String constants: TenantId, UserId, CorrelationId, TraceSessionId, RuleCode, RequestName.

Samples

  • Quickstart.Logging — ASP.NET Core API that demonstrates AddMuonroiLogging(), IMLog<T> injection, and IMLogContext.PushProperty scopes.
  • Muonroi.Pdf.AotSample — shows a no-op IMLog<T> open-generic registration for AOT / trimmed hosts that cannot use the full Serilog provider.

Compatibility

  • Target framework: net8.0
  • License: Apache-2.0 (OSS)
  • Muonroi.Logging — concrete implementation; registers MLog<T>, MLogContext, MLogFactory, and ILogScopeFactory via builder.Logging.AddMuonroiLogging().

License

Apache-2.0. See LICENSE-APACHE for details.

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 (19)

Showing the top 5 NuGet packages that depend on Muonroi.Logging.Abstractions:

Package Downloads
Muonroi.RuleEngine.Core

Rule Engine Core implementation for Muonroi.BuildingBlock

Muonroi.Core.Abstractions

Core contracts, interfaces, and base types for the Muonroi ecosystem. Required by all Muonroi packages.

Muonroi.Tenancy.Core

Shared-database multi-tenancy core: EF Core global filters, tenant context propagation, and quota tracking.

Muonroi.Logging

Structured logging implementation for Muonroi: IMLog wrapper, log scope factory, and Serilog/Microsoft.Extensions.Logging bridge.

Muonroi.Mediator

Mediator pattern implementation for Muonroi: command/query dispatching, pipeline behaviors, and validation integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.16 338 6/22/2026
1.0.0-alpha.15 351 5/31/2026
1.0.0-alpha.14 341 5/15/2026
1.0.0-alpha.13 275 5/2/2026
1.0.0-alpha.12 142 4/2/2026
1.0.0-alpha.11 185 4/2/2026
1.0.0-alpha.9 136 3/30/2026
1.0.0-alpha.8 373 3/28/2026
1.0.0-alpha.7 94 3/27/2026
1.0.0-alpha.5 93 3/27/2026
1.0.0-alpha.4 88 3/27/2026
1.0.0-alpha.3 89 3/27/2026
1.0.0-alpha.2 99 3/26/2026
1.0.0-alpha.1 129 3/8/2026