LogTide.SDK 0.8.3

dotnet add package LogTide.SDK --version 0.8.3
                    
NuGet\Install-Package LogTide.SDK -Version 0.8.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LogTide.SDK" Version="0.8.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogTide.SDK" Version="0.8.3" />
                    
Directory.Packages.props
<PackageReference Include="LogTide.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LogTide.SDK --version 0.8.3
                    
#r "nuget: LogTide.SDK, 0.8.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LogTide.SDK@0.8.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LogTide.SDK&version=0.8.3
                    
Install as a Cake Addin
#tool nuget:?package=LogTide.SDK&version=0.8.3
                    
Install as a Cake Tool

<p align="center"> <img src="https://raw.githubusercontent.com/logtide-dev/logtide/main/docs/images/logo.png" alt="LogTide Logo" width="400"> </p>

<h1 align="center">LogTide .NET SDK</h1>

<p align="center"> <a href="https://www.nuget.org/packages/LogTide.SDK"><img src="https://img.shields.io/nuget/v/LogTide.SDK?color=blue" alt="NuGet"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a> <a href="https://dotnet.microsoft.com/"><img src="https://img.shields.io/badge/.NET-8.0+-purple.svg" alt=".NET"></a> <a href="https://github.com/logtide-dev/logtide-sdk-csharp/releases"><img src="https://img.shields.io/github/v/release/logtide-dev/logtide-sdk-csharp" alt="Release"></a> </p>

<p align="center"> Official .NET SDK for <a href="https://logtide.dev">LogTide</a> with automatic batching, retry logic, circuit breaker, W3C distributed tracing, span tracking, breadcrumbs, and ASP.NET Core middleware support. </p>


Features

  • Automatic batching with configurable size and interval
  • Retry logic with exponential backoff
  • Circuit breaker pattern for fault tolerance
  • W3C traceparent distributed tracing
  • Span tracking with OpenTelemetry-compatible export
  • AsyncLocal scope for ambient trace context
  • Breadcrumbs for event tracking within a scope
  • Composable transport layer (LogTide HTTP, OTLP)
  • Integration system (global error handler, extensible)
  • Serilog sink (LogTide.SDK.Serilog)
  • DSN connection string support
  • ASP.NET Core middleware with sensitive header filtering
  • Query API for searching and filtering logs
  • Dependency injection with IHttpClientFactory
  • Full async/await support
  • Thread-safe

Requirements

  • .NET 8.0 or .NET 9.0

Installation

dotnet add package LogTide.SDK

For Serilog integration:

dotnet add package LogTide.SDK.Serilog

Quick Start

using LogTide.SDK.Core;
using LogTide.SDK.Models;

// Create client with DSN
await using var client = LogTideClient.FromDsn("https://lp_your_key@api.logtide.dev");

// Send logs
client.Info("api-gateway", "Server started", new() { ["port"] = 3000 });
client.Error("database", "Connection failed", new Exception("Timeout"));

// Use scoped tracing
using (var scope = LogTideScope.Create())
{
    client.Info("api", "Request received");   // automatically gets W3C trace ID
    client.Info("db", "Query executed");       // same trace ID
}

ASP.NET Core Integration

using LogTide.SDK.Core;
using LogTide.SDK.Middleware;
using LogTide.SDK.Models;

var builder = WebApplication.CreateBuilder(args);

// Register LogTide with IHttpClientFactory
builder.Services.AddLogTide(new ClientOptions
{
    ApiUrl = builder.Configuration["LogTide:ApiUrl"]!,
    ApiKey = builder.Configuration["LogTide:ApiKey"]!,
    ServiceName = "my-api",
    GlobalMetadata = new() { ["env"] = builder.Environment.EnvironmentName }
});

var app = builder.Build();

// Catch unhandled exceptions
app.UseLogTideErrors();

// Auto-log HTTP requests with W3C traceparent support
app.UseLogTide(o => o.ServiceName = "my-api");

app.MapGet("/", (ILogTideClient logger) =>
{
    logger.Info("my-api", "Hello!");
    return Results.Ok();
});

app.Run();

The middleware automatically:

  • Parses incoming traceparent headers (W3C standard)
  • Creates a LogTideScope per request
  • Starts and finishes a span per request
  • Emits traceparent response header
  • Filters sensitive headers (Authorization, Cookie, etc.)

Span Tracking

using var scope = LogTideScope.Create();

var span = client.StartSpan("process-order");
span.SetAttribute("order.id", "ORD-123");

// ... do work ...

span.AddEvent("validation-complete");
client.FinishSpan(span, SpanStatus.Ok);

Spans are exported in OTLP format to /v1/otlp/traces.


using var scope = LogTideScope.Create();

client.AddBreadcrumb(new Breadcrumb { Message = "User clicked button", Type = "ui" });
client.AddBreadcrumb(new Breadcrumb { Message = "API call started", Type = "http" });

// Breadcrumbs are automatically attached to logs within this scope
client.Error("app", "Something failed");

Serilog Integration

using LogTide.SDK.Serilog;

await using var logtideClient = LogTideClient.FromDsn("https://lp_key@api.logtide.dev");

Log.Logger = new LoggerConfiguration()
    .WriteTo.Console()
    .WriteTo.LogTide(logtideClient, serviceName: "my-service")
    .CreateLogger();

Log.Information("User {UserId} logged in", 42);  // forwarded to LogTide

Configuration Options

Option Type Default Description
ApiUrl string required Base URL of your LogTide instance
ApiKey string required Project API key (starts with lp_)
Dsn string? null DSN string (alternative to ApiUrl + ApiKey)
ServiceName string "app" Service name for tracing
BatchSize int 100 Logs to batch before sending
FlushIntervalMs int 5000 Auto-flush interval in ms
MaxBufferSize int 10000 Max buffer size (drop policy)
MaxRetries int 3 Retry attempts on failure
RetryDelayMs int 1000 Initial retry delay (exponential backoff)
CircuitBreakerThreshold int 5 Failures before opening circuit
CircuitBreakerResetMs int 30000 Time before retrying after circuit opens
TracesSampleRate double 1.0 Sample rate for traces
Integrations List<IIntegration> [] Integrations to register
GlobalMetadata Dictionary {} Metadata added to all logs
Debug bool false Enable debug logging to console

Breaking Changes (v0.8.3)

  • SetTraceId(), GetTraceId(), WithTraceId(), WithNewTraceId() removed — use LogTideScope.Create(traceId)
  • LogTideMiddlewareOptions.Client removed — client resolved from DI
  • Default trace header: X-Trace-Id replaced by W3C traceparent
  • Target frameworks: net8.0;net9.0 (dropped net6/net7)
  • LogTideClient is now sealed, implements ILogTideClient
  • LogEntry has new optional fields SpanId, SessionId

Examples

See the examples/ directory for complete working examples.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LogTide.SDK:

Package Downloads
LogTide.SDK.Serilog

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.3 130 3/23/2026
0.1.0 120 1/11/2026