{"id":48249970,"url":"https://github.com/logtide-dev/logtide-dotnet","last_synced_at":"2026-06-11T14:00:27.817Z","repository":{"id":331971468,"uuid":"1113423528","full_name":"logtide-dev/logtide-dotnet","owner":"logtide-dev","description":"  Official .NET SDK for LogTide - Production-ready logging with automatic batching, circuit breaker, distributed   tracing, and ASP.NET Core middleware support","archived":false,"fork":false,"pushed_at":"2026-06-11T12:23:36.000Z","size":138,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-11T13:16:22.270Z","etag":null,"topics":["aspnetcore","async","batching","circuit-breaker","csharp","dependency-injection","distributed-tracing","dotnet","log-management","logging","middlewares","observabilty","retry-logic","sdk"],"latest_commit_sha":null,"homepage":"https://logtide.dev/docs/sdks/csharp/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logtide-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-10T00:44:25.000Z","updated_at":"2026-06-11T12:21:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/logtide-dev/logtide-dotnet","commit_stats":null,"previous_names":["logtide-dev/logtide-sdk-csharp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/logtide-dev/logtide-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logtide-dev","download_url":"https://codeload.github.com/logtide-dev/logtide-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34201842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","async","batching","circuit-breaker","csharp","dependency-injection","distributed-tracing","dotnet","log-management","logging","middlewares","observabilty","retry-logic","sdk"],"created_at":"2026-04-04T20:48:40.572Z","updated_at":"2026-06-11T14:00:27.796Z","avatar_url":"https://github.com/logtide-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/logtide-dev/logtide/main/docs/images/logo.png\" alt=\"LogTide Logo\" width=\"400\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eLogTide .NET SDK\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.nuget.org/packages/LogTide.SDK\"\u003e\u003cimg src=\"https://img.shields.io/nuget/v/LogTide.SDK?color=blue\" alt=\"NuGet\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://dotnet.microsoft.com/\"\u003e\u003cimg src=\"https://img.shields.io/badge/.NET-8.0+-purple.svg\" alt=\".NET\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/logtide-dev/logtide-sdk-csharp/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/logtide-dev/logtide-sdk-csharp\" alt=\"Release\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Official .NET SDK for \u003ca href=\"https://logtide.dev\"\u003eLogTide\u003c/a\u003e with automatic batching, retry logic, circuit breaker, W3C distributed tracing, span tracking, breadcrumbs, and ASP.NET Core middleware support.\n\u003c/p\u003e\n\n---\n\n## Features\n\n- **Automatic batching** with configurable size and interval\n- **Retry logic** with exponential backoff\n- **Circuit breaker** pattern for fault tolerance\n- **W3C traceparent** distributed tracing\n- **Span tracking** with OpenTelemetry-compatible export\n- **AsyncLocal scope** for ambient trace context\n- **Breadcrumbs** for event tracking within a scope\n- **Composable transport layer** (LogTide HTTP, OTLP)\n- **Integration system** (global error handler, extensible)\n- **Serilog sink** (`LogTide.SDK.Serilog`)\n- **DSN connection string** support\n- **ASP.NET Core middleware** with sensitive header filtering\n- **Query API** for searching and filtering logs\n- **Dependency injection** with `IHttpClientFactory`\n- **Full async/await support**\n- **Thread-safe**\n\n## Requirements\n\n- .NET 8.0 or .NET 9.0\n\n## Installation\n\n```bash\ndotnet add package LogTide.SDK\n```\n\nFor Serilog integration:\n\n```bash\ndotnet add package LogTide.SDK.Serilog\n```\n\n## Quick Start\n\n```csharp\nusing LogTide.SDK.Core;\nusing LogTide.SDK.Models;\n\n// Create client with DSN\nawait using var client = LogTideClient.FromDsn(\"https://lp_your_key@api.logtide.dev\");\n\n// Send logs\nclient.Info(\"api-gateway\", \"Server started\", new() { [\"port\"] = 3000 });\nclient.Error(\"database\", \"Connection failed\", new Exception(\"Timeout\"));\n\n// Use scoped tracing\nusing (var scope = LogTideScope.Create())\n{\n    client.Info(\"api\", \"Request received\");   // automatically gets W3C trace ID\n    client.Info(\"db\", \"Query executed\");       // same trace ID\n}\n```\n\n---\n\n## ASP.NET Core Integration\n\n```csharp\nusing LogTide.SDK.Core;\nusing LogTide.SDK.Middleware;\nusing LogTide.SDK.Models;\n\nvar builder = WebApplication.CreateBuilder(args);\n\n// Register LogTide with IHttpClientFactory\nbuilder.Services.AddLogTide(new ClientOptions\n{\n    ApiUrl = builder.Configuration[\"LogTide:ApiUrl\"]!,\n    ApiKey = builder.Configuration[\"LogTide:ApiKey\"]!,\n    ServiceName = \"my-api\",\n    GlobalMetadata = new() { [\"env\"] = builder.Environment.EnvironmentName }\n});\n\nvar app = builder.Build();\n\n// Catch unhandled exceptions\napp.UseLogTideErrors();\n\n// Auto-log HTTP requests with W3C traceparent support\napp.UseLogTide(o =\u003e o.ServiceName = \"my-api\");\n\napp.MapGet(\"/\", (ILogTideClient logger) =\u003e\n{\n    logger.Info(\"my-api\", \"Hello!\");\n    return Results.Ok();\n});\n\napp.Run();\n```\n\nThe middleware automatically:\n- Parses incoming `traceparent` headers (W3C standard)\n- Creates a `LogTideScope` per request\n- Starts and finishes a span per request\n- Emits `traceparent` response header\n- Filters sensitive headers (`Authorization`, `Cookie`, etc.)\n\n---\n\n## Span Tracking\n\n```csharp\nusing var scope = LogTideScope.Create();\n\nvar span = client.StartSpan(\"process-order\");\nspan.SetAttribute(\"order.id\", \"ORD-123\");\n\n// ... do work ...\n\nspan.AddEvent(\"validation-complete\");\nclient.FinishSpan(span, SpanStatus.Ok);\n```\n\nSpans are exported in OTLP format to `/v1/otlp/traces`.\n\n---\n\n## Breadcrumbs\n\n```csharp\nusing var scope = LogTideScope.Create();\n\nclient.AddBreadcrumb(new Breadcrumb { Message = \"User clicked button\", Type = \"ui\" });\nclient.AddBreadcrumb(new Breadcrumb { Message = \"API call started\", Type = \"http\" });\n\n// Breadcrumbs are automatically attached to logs within this scope\nclient.Error(\"app\", \"Something failed\");\n```\n\n---\n\n## Serilog Integration\n\n```csharp\nusing LogTide.SDK.Serilog;\n\nawait using var logtideClient = LogTideClient.FromDsn(\"https://lp_key@api.logtide.dev\");\n\nLog.Logger = new LoggerConfiguration()\n    .WriteTo.Console()\n    .WriteTo.LogTide(logtideClient, serviceName: \"my-service\")\n    .CreateLogger();\n\nLog.Information(\"User {UserId} logged in\", 42);  // forwarded to LogTide\n```\n\n### Alternative: Serilog.Sinks.OpenTelemetry\n\nIf you prefer to use the community [`Serilog.Sinks.OpenTelemetry`](https://github.com/serilog/serilog-sinks-opentelemetry) package directly, for example to share a single sink configuration for logs and traces, point it at LogTide's OTLP endpoints:\n\n```csharp\nusing Serilog;\nusing Serilog.Sinks.OpenTelemetry;\n\nLog.Logger = new LoggerConfiguration()\n    .WriteTo.OpenTelemetry(options =\u003e\n    {\n        options.LogsEndpoint   = \"https://your-logtide-host/v1/otlp/logs\";\n        options.TracesEndpoint = \"https://your-logtide-host/v1/otlp/traces\";\n        options.Protocol = OtlpProtocol.HttpProtobuf;\n        options.Headers = new Dictionary\u003cstring, string\u003e\n        {\n            [\"X-API-Key\"] = \"lp_your_key\"\n        };\n    })\n    .CreateLogger();\n```\n\n\u003e **Important:** always set `LogsEndpoint` and `TracesEndpoint` to the **full URL including the path**. Setting only `options.Endpoint = \"https://your-logtide-host\"` causes `Serilog.Sinks.OpenTelemetry` to auto-append `/v1/logs` and `/v1/traces`, which do **not** match LogTide's OTLP routes (`/v1/otlp/logs` and `/v1/otlp/traces`). If you set `Endpoint` to the full OTLP path, the sink will append the suffix again and produce a broken URL like `.../v1/otlp/logs/v1/logs`.\n\n---\n\n## Configuration Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `ApiUrl` | `string` | **required** | Base URL of your LogTide instance |\n| `ApiKey` | `string` | **required** | Project API key (starts with `lp_`) |\n| `Dsn` | `string?` | `null` | DSN string (alternative to ApiUrl + ApiKey) |\n| `ServiceName` | `string` | `\"app\"` | Service name for tracing |\n| `BatchSize` | `int` | `100` | Logs to batch before sending |\n| `FlushIntervalMs` | `int` | `5000` | Auto-flush interval in ms |\n| `MaxBufferSize` | `int` | `10000` | Max buffer size (drop policy) |\n| `MaxRetries` | `int` | `3` | Retry attempts on failure |\n| `RetryDelayMs` | `int` | `1000` | Initial retry delay (exponential backoff) |\n| `CircuitBreakerThreshold` | `int` | `5` | Failures before opening circuit |\n| `CircuitBreakerResetMs` | `int` | `30000` | Time before retrying after circuit opens |\n| `TracesSampleRate` | `double` | `1.0` | Sample rate for traces |\n| `Integrations` | `List\u003cIIntegration\u003e` | `[]` | Integrations to register |\n| `GlobalMetadata` | `Dictionary` | `{}` | Metadata added to all logs |\n| `Debug` | `bool` | `false` | Enable debug logging to console |\n\n---\n\n## Breaking Changes (v0.8.3)\n\n- `SetTraceId()`, `GetTraceId()`, `WithTraceId()`, `WithNewTraceId()` removed — use `LogTideScope.Create(traceId)`\n- `LogTideMiddlewareOptions.Client` removed — client resolved from DI\n- Default trace header: `X-Trace-Id` replaced by W3C `traceparent`\n- Target frameworks: `net8.0;net9.0` (dropped net6/net7)\n- `LogTideClient` is now `sealed`, implements `ILogTideClient`\n- `LogEntry` has new optional fields `SpanId`, `SessionId`\n\n---\n\n## Examples\n\nSee the [examples/](./examples) directory for complete working examples.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Links\n\n- [LogTide Website](https://logtide.dev)\n- [Documentation](https://logtide.dev/docs/sdks/dotnet/)\n- [GitHub Issues](https://github.com/logtide-dev/logtide-sdk-csharp/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogtide-dev%2Flogtide-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogtide-dev%2Flogtide-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogtide-dev%2Flogtide-dotnet/lists"}