-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Your project must target .NET 8.0 or later. The package ships native assemblies for
.NET 8, .NET 9, and .NET 10; NuGet automatically picks the one matching your
<TargetFramework>.
There are no other dependencies — only the .NET base class library.
dotnet add package Thushar.LoggingOr via the Package Manager Console:
Install-Package Thushar.LoggingOr add it to your .csproj directly:
<ItemGroup>
<PackageReference Include="Thushar.Logging" Version="11.0.0" />
</ItemGroup>using Thushar.Logging;
Log.Information("Application started");2026-06-27 09:14:02.318 🟩 [INFO] Application started
That's it — no configuration, no DI, no setup. The logger has sensible defaults (text
output, minimum level Information, UTC timestamps) and works the moment you call it.
The logger types live in the Thushar.Logging namespace, so you normally need:
using Thushar.Logging;The exception is when your own code is in a child namespace of Thushar.Logging (e.g.
Thushar.Logging.Samples.Lambda) — then the types are already in scope through the namespace
hierarchy and no using is required. See the FAQ
for the details.
Configure once at application startup. It's safe to call again to reconfigure.
using Thushar.Logging;
Log.Configure(o => o
.UseStructured() // JSON instead of text
.SetMinimumLevel(LogLevel.Debug));
Log.Debug("Cache miss for {key}", "user:42");{"timestamp":"2026-06-27 09:14:02.401","level":"Debug","icon":"🟦","message":"Cache miss for user:42","key":"user:42"}See Configuration for the full set of options.
When you want to know where a line came from, use the typed logger Log<T>:
public class OrderService
{
public void Process()
{
Log<OrderService>.Information("Processing started");
// text: 2026-… 🟩 [INFO] [OrderService.Process] Processing started
}
}Log<T> and the non-generic Log behave differently on purpose — read
Log vs Log<T> next so the difference doesn't surprise you.
- Log vs Log<T> — the key concept.
-
Message Templates & Structured Logging — how
{placeholder}fields work. - Integration Guides — console, Web API, and Lambda setups you can copy.
Thushar.Logging · a zero-dependency static logger for .NET
📦 NuGet · 💻 GitHub · 🐛 Issues · 📸 Instagram
dotnet add package Thushar.Logging
Getting around
Features
Using it
Under the hood