Zero-allocation .NET/Unity logger
Top 27.6% on sourcepulse
ZLogger is a high-performance logging library for .NET and Unity, designed for zero-allocation and leveraging modern C# features like string interpolation and source generators. It integrates seamlessly with Microsoft.Extensions.Logging
, offering significant performance gains by avoiding intermediate string allocations and UTF-16 to UTF-8 encoding overhead.
How It Works
ZLogger utilizes C# 10's interpolated string handlers and .NET 8's IUtf8SpanFormattable
to directly format log messages into UTF-8 byte spans. This bypasses the boxing of values and the creation of intermediate string
objects, leading to substantial performance improvements. By integrating directly with Microsoft.Extensions.Logging
's abstraction, it eliminates the overhead typically associated with bridging different logging systems.
Quick Start & Requirements
dotnet add package ZLogger
csc.rsp
configuration for C# 10/11 features in Unity.WebApplication.CreateBuilder().Logging.AddZLoggerConsole();
or LoggerFactory.Create(logging => logging.AddZLoggerConsole());
.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
csc.rsp
) and potentially NuGetForUnity
and CsprojModifier
.2 months ago
Inactive