PicoLog.DI 2026.6.0

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

PicoLog

High-performance structured logging for .NET Native AOT.

Quick Start

dotnet add package PicoLog
using PicoLog;
using PicoLog.Abs;

var sink = new ColoredConsoleSink(new ConsoleFormatter());
using var factory = new LoggerFactory([sink],
    new LoggerFactoryOptions { MinLevel = LogLevel.Info });
var logger = factory.CreateLogger("App");
logger.Info("Application started");

Log Levels

Level Value Usage
Emergency 0 System is unusable
Alert 1 Action must be taken immediately
Critical 2 Critical conditions
Error 3 Error conditions
Warning 4 Warning conditions
Notice 5 Normal but significant
Info 6 Informational messages
Debug 7 Debug-level messages
Trace 8 Detailed diagnostic tracing
None 255 Disables all logging

Message Templates

logger.Info($"Processing order {orderId} for {customer}");

// Structured logging with explicit properties
logger.LogStructured(LogLevel.Error, "Payment failed",
    properties: [new("OrderId", orderId), new("Amount", amount)],
    exception: ex);

Source-Generated Messages

public static partial class AppLogs
{
    [PicoLogMessage(LogLevel.Info, EventId = 1001, Message = "Order {OrderId} placed")]
    public static partial void OrderPlaced(this ILogger logger, string orderId);
}

logger.OrderPlaced("ORD-12345");

Built-in Sinks

var sinks = new List<ILogSink>
{
    new ConsoleSink(new ConsoleFormatter()),
    new ColoredConsoleSink(new ConsoleFormatter()),
    new FileSink(new ConsoleFormatter(),
        new FileSinkOptions { FilePath = "app.log", BatchSize = 100 })
};

Custom Sinks

public sealed class CustomSink : ILogSink
{
    public Task WriteAsync(LogEntry entry, CancellationToken ct = default)
    {
        // Write to your backend
        return Task.CompletedTask;
    }
    public void Dispose() { }
    public ValueTask DisposeAsync() => ValueTask.CompletedTask;
}

DI Integration (PicoLog.DI)

container.AddPicoLog(o =>
{
    o.MinLevel = LogLevel.Info;
    o.WriteTo.ColoredConsole();
    o.WriteTo.File("app.log");
});
var logger = container.CreateScope().GetService<ILogger<Program>>();

Packages

Package Description
PicoLog Logging runtime
PicoLog.Abs ILogger, ILogSink, LogLevel, LogEntry
PicoLog.Gen [PicoLogMessage] source generator
PicoLog.DI DI integration

← Back to PicoHex

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.6.0 84 5/14/2026
2026.2.3 91 5/10/2026
2026.2.2 88 5/10/2026
2026.2.1 101 4/8/2026
2026.2.0 99 4/6/2026
2026.1.5 92 4/27/2026
2026.1.4 96 4/26/2026
2026.1.3 93 4/20/2026