Muonroi.Logging.Abstractions
1.0.0-alpha.16
dotnet add package Muonroi.Logging.Abstractions --version 1.0.0-alpha.16
NuGet\Install-Package Muonroi.Logging.Abstractions -Version 1.0.0-alpha.16
<PackageReference Include="Muonroi.Logging.Abstractions" Version="1.0.0-alpha.16" />
<PackageVersion Include="Muonroi.Logging.Abstractions" Version="1.0.0-alpha.16" />
<PackageReference Include="Muonroi.Logging.Abstractions" />
paket add Muonroi.Logging.Abstractions --version 1.0.0-alpha.16
#r "nuget: Muonroi.Logging.Abstractions, 1.0.0-alpha.16"
#:package Muonroi.Logging.Abstractions@1.0.0-alpha.16
#addin nuget:?package=Muonroi.Logging.Abstractions&version=1.0.0-alpha.16&prerelease
#tool nuget:?package=Muonroi.Logging.Abstractions&version=1.0.0-alpha.16&prerelease
Muonroi.Logging.Abstractions
Contracts-only package that defines the
IMLog<T>,IMLogContext, and log-property conventions used across the Muonroi ecosystem.
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 extendingILogger/ILogger<T>with shorthand methods (Info,Warn,Error,Debug,InfoTrace) andBeginPropertyscoping.IMLogFactory— factory interface for creatingIMLoginstances by type or category name.IMLogContext— ambient property bag; push key-value pairs into the logging context withPushProperty/PushProperties.IMLogContextScope— disposable scope returned byBeginProperty/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, andIMLogContext.PushPropertyscopes. - 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)
Related Packages
Muonroi.Logging— concrete implementation; registersMLog<T>,MLogContext,MLogFactory, andILogScopeFactoryviabuilder.Logging.AddMuonroiLogging().
License
Apache-2.0. See LICENSE-APACHE for details.
| Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
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 |