LogMachina 1.1.0

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

LogMachina

LogMachina is a lightweight logging abstraction for .NET.

Use this package when you want application code to depend on a small provider-agnostic interface while still keeping the source type of each logger explicit through ILogMachina<TSource>.

What this package provides

  • ILogMachina<TSource> for typed logging
  • ILogMachina for the common logging operations
  • ILogMachinaFactory for creating typed loggers outside constructor injection

The abstraction exposes a small fixed set of methods:

public interface ILogMachina
{
    void Debug(string message);
    void Error(string message);
    void Error(Exception ex);
    void Info(string message);
    void Trace(string message);
    void Warn(string message);
}

Install

dotnet add package LogMachina

To actually emit logs, add a provider package such as:

dotnet add package LogMachina.NLog

If you want automatic registration with IServiceCollection, also add:

dotnet add package LogMachina.DependencyInjection

Basic usage

Your application code depends only on the abstraction:

using LogMachina;

public sealed class OrderProcessor
{
    private readonly ILogMachina<OrderProcessor> Log;

    public OrderProcessor(ILogMachina<OrderProcessor> Log)
    {
        Log = log;
    }

    public void Process()
    {
        Log.Info("Processing order");
        .
        .
        .
        Log.Warn("Using fallback path");
    }
}

TSource identifies the component producing the log entry, so each class can depend on its own typed logger:

  • ILogMachina<OrderProcessor>
  • ILogMachina<PaymentService>
  • ILogMachina<Worker>

Factory usage

If you need to create a typed logger dynamically, depend on ILogMachinaFactory:

using LogMachina;

public sealed class DynamicLoggerConsumer
{
    private readonly ILogMachinaFactory Factory;

    public DynamicLoggerConsumer(ILogMachinaFactory factory)
    {
        Factory = factory;
    }

    public void Run()
    {
        var log = Factory.Create<DynamicLoggerConsumer>();
        log.Info("Created from factory");
    }
}

Typical package combination

In a real application, LogMachina is usually used together with:

  • an actual loggin provider, such as LogMachina.NLog for the concrete NLog-backed implementation
  • optionally, with a DI contianer integration, such as LogMachina.DependencyInjection for IServiceCollection registration

Example:

using LogMachina;
using LogMachina.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

services.AddLogMachina(x => x.WithNLog());

using var provider = services.BuildServiceProvider();

var log = provider.GetRequiredService<ILogMachina<OrderProcessor>>();
log.Info("Resolved from DI");

Scope and limitations

This package defines the abstraction only. It does not:

  • write logs by itself
  • configure a concrete logging provider
  • provide structured logging payloads or provider-specific features

Those concerns belong to the provider package you choose to use.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on LogMachina:

Package Downloads
LogMachina.SimpleInjector

A simplified logging interface for .NET

LogMachina.NLog

A simplified logging interface for .NET

LogMachina.DependencyInjection

A simplified logging interface for .NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 174 4/3/2026
1.0.2 153 3/26/2026
1.0.1 122 3/25/2026
1.0.0 139 3/24/2026

Removed provider assembly scanning. Added callback-based provider selection with explicit validation.