Thread-static StringBuilder reuse, cached severity strings, zero-alloc filtered calls. Built for hot paths.
Drop-in ILoggerProvider. One line to wire up with ASP.NET Core or Generic Host.
Export OpenTelemetry log records in logfmt format with trace context, attributes, and exceptions.
Targets .NET 8.0 and .NET 10.0. Nullable reference types, file-scoped namespaces, implicit usings.
Console by default, or any Stream. WithData() builder pattern for default fields across log entries.
Shared write locks across WithData-derived loggers. Safe for concurrent multi-threaded logging.
using Logfmt; var log = new Logger(); log.Info("Server started", "port", "8080"); // With default fields on every entry var log = new Logger().WithData("service", "api"); log.Info("Request handled", "status", "200");
using Logfmt.ExtensionLogging; builder.Logging.ClearProviders(); builder.Logging.AddLogfmt(); // Then inject and use ILogger as usual _logger.LogInformation("Processing {RequestId}", id);
using Logfmt.OpenTelemetryLogging; builder.Logging.AddOpenTelemetry(options => { options.AddLogfmtConsoleExporter(); });