DevLogBus

.NET / C# SDK

The .NET SDK lives in:

sdk/dotnet

It publishes to the DevLogBus HTTP API using HttpClient and System.Text.Json, so .NET app records can appear beside backend, CLI, browser, journal, HTTP, and other SDK records. The default endpoint is:

http://127.0.0.1:7423

Scope

The .NET SDK includes:

It does not include background queues, socket protocol support, hosted service registration, or a dependency on Microsoft.Extensions.Logging.

Install

dotnet add package DanSherwin.DevLogBus.Sdk

Build And Test

dotnet run --project sdk/dotnet/DevLogBus.Sdk.Tests

Client

using DanSherwin.DevLogBus;

var devlog = new DevLogBusClient(new DevLogBusClientOptions
{
    Source = "checkout_api",
});

await devlog.PublishMessageAsync(
    "INFO",
    "checkout started",
    new Dictionary<string, object?> { ["requestId"] = "req-1" });

Pass Endpoint explicitly for a different local or trusted-network daemon:

var devlog = new DevLogBusClient(new DevLogBusClientOptions
{
    Endpoint = "http://devbox:7423",
    Source = "checkout_api",
});

Logger Helper

var logger = devlog.Logger();

await logger.WarnAsync(
    "payment provider slow",
    new Dictionary<string, object?> { ["elapsedMs"] = 812 });

Filters And Redaction

Filters drop records before publishing. Redactors return the record shape that will be sent to the daemon.

var devlog = new DevLogBusClient(new DevLogBusClientOptions
{
    Source = "checkout_api",
    Filter = DevLogBusClient.DropSources("noisy_worker"),
    Redactor = DevLogBusClient.RedactMessage(),
});

Use Attrs for normal structured metadata. Use AttrsJson only when the caller already has a JSON object string and does not want the SDK to rebuild it.