Observability

SinkSharp: a non-blocking structured logging library for .NET

DEV Community: #dotnetcore Prabhu Siva
Observability

SinkSharp is a new structured logging library on NuGet that bills itself as a Serilog/NLog replacement whose logging calls never block on a slow or failing sink, shipping an in-process dashboard, OTLP export, chat alerts and PII masking.

Key points

  • Every log call hands a LogEvent to an in-memory async queue, so the calling thread never waits on a sink.
  • The queue is striped across several channels and drained by background workers instead of serialising behind one.
  • DashboardSink mounts a live log viewer at /sinksharp/dashboard with client-side filters over structured properties.
  • PII masking (email, phone, card, SSN) runs in-process before an event reaches any sink, including OTLP.
  • v1.0.3 writes OTLP Protobuf messages into pooled ArrayPool<byte> buffers to cut per-event allocations on that path.
  • v1.1.0 binds minimum log levels from the SinkSharp configuration section through ReadFrom(configuration).

Why it matters

Anyone who has seen request latency spike when a file or network sink stalled will recognise the appeal. Serilog's async wrapper makes the same trade, but here it is the default rather than an add-on, and the queue is striped across channels instead of serialising behind one. The benchmark table is the project's own run on .NET 9.0.23, so treat the 5.7× headline as a hypothesis, not proof.

Before swapping, note the API is its own (AddSinkSharp, SinkSharpBuilder), so migration is real work rather than a package rename, and config binding in v1.1.0 covers minimum levels only. Sink and enricher breadth is where mature ecosystems usually win.

Real-world use

  • A high-throughput API where a network or file sink occasionally stalls and logging must not add latency to the request.
  • Local development or small deployments that want a live log viewer without standing up an external aggregator.
  • Worker services and console apps with no web host that still need the dashboard reachable on its own port.
  • Chatty services where only Error and Critical events should reach Slack or Teams alert channels.

This summary was generated by the agent from the original post on DEV Community: #dotnetcore. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message