Skip to content
thushxr edited this page Jun 27, 2026 · 2 revisions

Thushar.Logging — Wiki

A tiny, zero-dependency static logger for .NET. No dependency injection, no ILogger wiring — add the package and call Log.Information(...).

This wiki is the complete reference. If you just want to get going, start with Getting Started. If you're trying to decide between the two loggers, read Log vs Log<T> — it's the one concept that trips people up.

Contents

Page What's in it
Getting Started Install, target frameworks, your first log line
Log vs Log<T> The two loggers, why they differ, which to pick
Message Templates & Structured Logging {placeholder} templates, JSON fields, reserved keys
Configuration Every option, every default, the fluent API
Log Levels The six levels, when to use each, filtering
Trace Correlation Trace scopes and correlation ids
Integration Guides Console · ASP.NET Core / Web API · AWS Lambda
API Reference The full public surface
Performance & Internals How it works, allocations, thread safety
FAQ Common questions and gotchas

The 30-second version

using Thushar.Logging;

// Works immediately — no setup.
Log.Information("User {userId} logged in", 42);

// Configure once at startup if you want JSON / a different level / etc.
Log.Configure(o => o.UseStructured().SetMinimumLevel(LogLevel.Debug));

// Want the class & method an entry came from? Use the typed logger.
Log<OrderService>.Information("Processing started");

Design in one paragraph

It's a static class, so you call it from anywhere without injecting anything. Messages are Serilog-style templates ("User {userId}") whose named values become first-class JSON fields. A separate generic logger, Log<T>, stamps each entry with the source class and method — captured at zero cost via typeof(T) and [CallerMemberName], with no stack walk. You can emit human-readable text or one-line JSON, and wrap work in a trace scope so related entries share a correlation id. It depends on nothing but the .NET base class library and ships native builds for .NET 8, 9, and 10.

Clone this wiki locally