Logsmith 0.6.0

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

Logsmith CI

Zero-allocation, source-generated structured logging for .NET 10.

Logsmith is a logging framework where the source generator is the framework. Every log method is analyzed at compile time, and the generator emits fully specialized, zero-allocation UTF8 code tailored to your exact parameters. No reflection. No boxing. No runtime parsing of message templates.

Documentation | API Reference


Packages

Name NuGet Description
Logsmith Logsmith Runtime library with public types, sinks, and the bundled source generator. Default mode: Shared.
Logsmith.Generator Logsmith.Generator Thin meta-package. Depends on Logsmith for the generator and build assets only — no runtime DLL. Default mode: Standalone.
Logsmith.Extensions.Logging Logsmith.Extensions.Logging Microsoft.Extensions.Logging bridge. Routes ILogger calls through Logsmith sinks.

Why Logsmith

Most .NET logging frameworks parse message templates at runtime, box value-type arguments into object[], and dispatch through multiple abstraction layers before bytes reach an output target. For applications where logging sits on the hot path — game engines, trading systems, NativeAOT deployments — those costs are measurable.

Logsmith takes the source-generator approach to its conclusion: the generator does not supplement a runtime framework, it replaces it entirely. It reads your method declarations at build time, knows the concrete types of every parameter, and emits direct UTF8 formatting calls with pre-computed property names and type-specific serialization paths.


Comparison with Other Frameworks

Capability Logsmith MEL + LoggerMessage ZLogger Serilog NLog
Source-generated method bodies Yes Yes Yes No No
Zero runtime dependency mode Yes (standalone) No (requires MEL) No (requires MEL) No No
Abstraction mode for libraries Yes No No No No
Zero allocation hot path Yes Partial (MEL infra allocates) Yes No No
UTF8 end-to-end Yes No (UTF16 strings) Yes No No
Structured logging Yes (Utf8JsonWriter) Yes Yes Yes Yes
Compile-time level stripping Yes ([Conditional]) No No No No
No boxing of value types Yes Yes (generated path) Yes No (object[] params) No (object[] params)
No reflection Yes Yes Partial No (used in enrichers) No (used in layouts)
NativeAOT compatible Yes Yes Yes Partial Partial
Compile-time diagnostics Yes (LSMITH001-010) Yes Limited No No
Log sampling / rate limiting Yes (compile-time) No No No No
Scoped context (AsyncLocal) Yes (LogScope) Yes (ILogger.BeginScope) Yes Yes (LogContext) Yes (ScopeContext)
Dynamic level switching Yes (env var, file) Yes (IOptionsMonitor) Yes Yes (LoggingLevelSwitch) Yes (config reload)
Custom type serialization ILogStructurable ILogger.BeginScope IZLoggerFormattable Destructure policies Custom layout renderers
MEL ecosystem compatibility Yes (bridge package) Native Native Via Serilog.Extensions.Logging Via NLog.Extensions.Logging
DI container required No Typically yes Typically yes No No
Transitive dependencies Zero (standalone) MEL abstractions MEL + ZLogger Serilog + sinks NLog

Features


Quick Start

// 1. Initialize at startup
LogManager.Initialize(config =>
{
    config.MinimumLevel = LogLevel.Debug;
    config.AddConsoleSink();
    config.AddFileSink("logs/app.log", rollingInterval: RollingInterval.Daily);
});

// 2. Declare log methods
[LogCategory("Renderer")]
public static partial class RenderLog
{
    [LogMessage(LogLevel.Debug, "Draw call {drawCallId} completed in {elapsedMs}ms")]
    public static partial void DrawCallCompleted(int drawCallId, double elapsedMs);

    [LogMessage(LogLevel.Error, "Shader compilation failed: {shaderName}")]
    public static partial void ShaderFailed(string shaderName, Exception ex);
}

// 3. Call them
RenderLog.DrawCallCompleted(42, 1.23);

The generator emits fully specialized, zero-allocation UTF8 code for each log method at compile time. See Getting Started for the full walkthrough.


Benchmarks

Full benchmark results comparing Logsmith against MEL, Serilog, NLog, and ZLogger are available in docs/benchmarks.md.


License

This project is licensed under the MIT License.

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

Showing the top 2 NuGet packages that depend on Logsmith:

Package Downloads
Logsmith.Generator

Logsmith source generator (standalone/abstraction mode meta-package). Depends on Logsmith for the generator and build assets.

Logsmith.Extensions.Logging

Microsoft.Extensions.Logging bridge for Logsmith

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 145 4/17/2026
0.5.0 804 3/20/2026
0.4.2 316 3/5/2026
0.4.1 96 3/5/2026
0.4.0 89 3/3/2026
0.3.2 101 2/20/2026
0.3.1 97 2/19/2026
0.3.0 95 2/19/2026
0.2.0 93 2/19/2026
0.1.3 99 2/18/2026
0.1.2 94 2/18/2026
0.1.1 92 2/18/2026
0.1.0 95 2/18/2026