{"id":48250010,"url":"https://github.com/logtide-dev/logtide-go","last_synced_at":"2026-04-04T20:48:45.960Z","repository":{"id":331960436,"uuid":"1107321870","full_name":"logtide-dev/logtide-go","owner":"logtide-dev","description":"  Official Go SDK for LogTide - Production-ready logging with automatic batching, circuit breaker, OpenTelemetry   integration, and Gin/Echo/Chi middleware support","archived":false,"fork":false,"pushed_at":"2026-03-22T13:51:49.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-23T04:52:52.874Z","etag":null,"topics":["batching","chi","circuit-breaker","distributed-tracing","echo","gin","go","golang","log-management","logging","logtide","middleware","observability","opentelemetry","retry-logic","sdk"],"latest_commit_sha":null,"homepage":"https://logtide.dev/docs/sdks/go/","language":"Go","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-01T01:10:56.000Z","updated_at":"2026-03-22T13:42:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/logtide-dev/logtide-go","commit_stats":null,"previous_names":["logtide-dev/logtide-sdk-go","logward-dev/logward-sdk-go","logtide-dev/logtide-go"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/logtide-dev/logtide-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logtide-dev","download_url":"https://codeload.github.com/logtide-dev/logtide-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logtide-dev%2Flogtide-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31413284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["batching","chi","circuit-breaker","distributed-tracing","echo","gin","go","golang","log-management","logging","logtide","middleware","observability","opentelemetry","retry-logic","sdk"],"created_at":"2026-04-04T20:48:45.314Z","updated_at":"2026-04-04T20:48:45.949Z","avatar_url":"https://github.com/logtide-dev.png","language":"Go","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 Go SDK\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pkg.go.dev/github.com/logtide-dev/logtide-sdk-go\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/logtide-dev/logtide-sdk-go.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/logtide-dev/logtide-sdk-go\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/logtide-dev/logtide-sdk-go\" alt=\"Go Report Card\"\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://github.com/logtide-dev/logtide-sdk-go/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/logtide-dev/logtide-sdk-go\" alt=\"Release\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Official Go SDK for \u003ca href=\"https://logtide.dev\"\u003eLogTide\u003c/a\u003e — structured logging with automatic batching, retry, circuit breaker, and OpenTelemetry integration.\n\u003c/p\u003e\n\n---\n\n## Features\n\n- **Leveled logging** — Debug, Info, Warn, Error, Critical, CaptureError\n- **Hub / Scope model** — per-request context isolation with breadcrumbs, tags, and user metadata\n- **Automatic batching** — configurable batch size and flush interval\n- **Retry with backoff** — exponential backoff with jitter\n- **Circuit breaker** — prevents cascading failures\n- **OpenTelemetry** — trace/span IDs extracted automatically; span exporter included\n- **net/http middleware** — per-request scope isolation out of the box\n- **Thread-safe** — safe for concurrent use\n\n## Requirements\n\n- Go 1.23 or later\n- A LogTide account and DSN\n\n## Installation\n\n```bash\ngo get github.com/logtide-dev/logtide-sdk-go\n```\n\n---\n\n## Quick Start\n\n### Global singleton (recommended for most apps)\n\n```go\npackage main\n\nimport (\n    \"context\"\n    logtide \"github.com/logtide-dev/logtide-sdk-go\"\n)\n\nfunc main() {\n    flush := logtide.Init(logtide.ClientOptions{\n        DSN:         \"https://lp_your_api_key@api.logtide.dev\",\n        Service:     \"my-service\",\n        Environment: \"production\",\n        Release:     \"v1.2.3\",\n    })\n    defer flush()\n\n    logtide.Info(context.Background(), \"Hello LogTide!\", nil)\n    logtide.Error(context.Background(), \"Something went wrong\", map[string]any{\n        \"user_id\": 42,\n    })\n}\n```\n\n### Explicit client\n\n```go\nopts := logtide.NewClientOptions()\nopts.DSN     = \"https://lp_your_api_key@api.logtide.dev\"\nopts.Service = \"my-service\"\n\nclient, err := logtide.NewClient(opts)\nif err != nil {\n    log.Fatal(err)\n}\ndefer client.Close()\n\nid := client.Info(context.Background(), \"Hello\", nil)\nfmt.Println(\"event id:\", id)\n```\n\n---\n\n## DSN format\n\n```\nhttps://{api_key}@{host}\n```\n\nExample: `https://lp_abc123@api.logtide.dev`\n\n---\n\n## Configuration\n\n```go\nopts := logtide.NewClientOptions()\nopts.DSN                    = \"https://lp_abc@api.logtide.dev\"\nopts.Service                = \"my-service\"       // required\nopts.Release                = \"v1.2.3\"\nopts.Environment            = \"production\"\nopts.Tags                   = map[string]string{\"region\": \"eu-west-1\"}\nopts.BatchSize              = 100                // entries per HTTP batch\nopts.FlushInterval          = 5 * time.Second\nopts.FlushTimeout           = 10 * time.Second\nopts.MaxRetries             = 3\nopts.RetryMinBackoff        = 1 * time.Second\nopts.RetryMaxBackoff        = 60 * time.Second\nopts.CircuitBreakerThreshold = 5               // consecutive failures before open\nopts.CircuitBreakerTimeout  = 30 * time.Second\nopts.AttachStacktrace       = logtide.Bool(true)\n```\n\n---\n\n## Logging\n\nAll log methods return the `EventID` assigned to the entry, or `\"\"` if the entry was dropped.\n\n```go\nctx := context.Background()\n\nclient.Debug(ctx, \"cache miss\", map[string]any{\"key\": \"user:42\"})\nclient.Info(ctx, \"request handled\", map[string]any{\"status\": 200, \"ms\": 12})\nclient.Warn(ctx, \"rate limit approaching\", nil)\nclient.Error(ctx, \"db query failed\", map[string]any{\"query\": \"SELECT ...\"})\nclient.Critical(ctx, \"out of memory\", nil)\n\n// Capture an error with full stack trace\nif err := doSomething(); err != nil {\n    client.CaptureError(ctx, err, map[string]any{\"op\": \"doSomething\"})\n}\n```\n\n---\n\n## Hub \u0026 Scope\n\nThe Hub/Scope model lets you attach contextual data (tags, breadcrumbs, user info, trace context) to all log entries within a logical unit of work.\n\n```go\n// Configure the global scope\nlogtide.ConfigureScope(func(s *logtide.Scope) {\n    s.SetTag(\"region\", \"eu-west-1\")\n    s.SetUser(logtide.User{ID: \"u123\", Email: \"alice@example.com\"})\n})\n\n// Per-request isolation via PushScope / PopScope\nlogtide.PushScope()\ndefer logtide.PopScope()\n\nlogtide.ConfigureScope(func(s *logtide.Scope) {\n    s.SetTag(\"request_id\", requestID)\n    s.AddBreadcrumb(\u0026logtide.Breadcrumb{\n        Category: \"auth\",\n        Message:  \"user authenticated\",\n        Level:    logtide.LevelInfo,\n        Timestamp: time.Now(),\n    }, nil)\n})\n\nlogtide.Info(ctx, \"processing order\", nil) // includes request_id tag + breadcrumb\n```\n\n---\n\n## net/http middleware\n\n```go\nimport lnethttp \"github.com/logtide-dev/logtide-sdk-go/integrations/nethttp\"\n\nhttp.Handle(\"/\", lnethttp.Middleware(myHandler))\n```\n\nThe middleware automatically:\n- clones the Hub for each request (scope isolation)\n- sets `http.method`, `http.url`, `http.host`, `http.client_ip` tags\n- parses the `Traceparent` header and stores trace/span IDs on the scope\n- adds request and response breadcrumbs\n\n---\n\n## OpenTelemetry\n\n### Automatic trace context extraction\n\nTrace and span IDs are extracted automatically from any active OTel span in the context:\n\n```go\nctx, span := tracer.Start(ctx, \"process-order\")\ndefer span.End()\n\n// trace_id and span_id are included automatically\nclient.Info(ctx, \"order processed\", map[string]any{\"order_id\": 99})\n```\n\n### Span exporter\n\nExport completed spans to LogTide:\n\n```go\nimport \"github.com/logtide-dev/logtide-sdk-go/integrations/otelexport\"\n\nintegration := otelexport.New()\n\nflush := logtide.Init(logtide.ClientOptions{\n    DSN:     \"https://lp_abc@api.logtide.dev\",\n    Service: \"my-service\",\n    Integrations: func(defaults []logtide.Integration) []logtide.Integration {\n        return append(defaults, integration)\n    },\n})\ndefer flush()\n\ntp := sdktrace.NewTracerProvider(\n    sdktrace.WithBatcher(integration.Exporter()),\n)\n```\n\n---\n\n## Flush \u0026 shutdown\n\n```go\n// Flush with deadline\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nclient.Flush(ctx)\n\n// Close flushes and releases all resources\nclient.Close()\n```\n\n---\n\n## BeforeSend hook\n\nInspect or drop entries before they are sent:\n\n```go\nopts.BeforeSend = func(entry *logtide.LogEntry, hint *logtide.EventHint) *logtide.LogEntry {\n    // drop health-check noise\n    if entry.Message == \"health check\" {\n        return nil\n    }\n    return entry\n}\n```\n\n---\n\n## Testing\n\nUse `NoopTransport` to silence all output in tests:\n\n```go\nclient, _ := logtide.NewClient(logtide.ClientOptions{\n    Service:   \"test\",\n    Transport: logtide.NoopTransport{},\n})\n```\n\n---\n\n## Examples\n\n| Example | Description |\n|---------|-------------|\n| [examples/basic](./examples/basic) | All log levels, metadata, CaptureError |\n| [examples/gin](./examples/gin) | Gin framework integration |\n| [examples/echo](./examples/echo) | Echo framework integration |\n| [examples/stdlib](./examples/stdlib) | Standard library net/http |\n| [examples/otel](./examples/otel) | OpenTelemetry distributed tracing |\n\n---\n\n## API reference\n\n- **Online:** [pkg.go.dev/github.com/logtide-dev/logtide-sdk-go](https://pkg.go.dev/github.com/logtide-dev/logtide-sdk-go)\n- **Local:** `godoc -http=:6060`\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogtide-dev%2Flogtide-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogtide-dev%2Flogtide-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogtide-dev%2Flogtide-go/lists"}