{"id":30886659,"url":"https://github.com/beatlabs/ctxlog","last_synced_at":"2025-09-08T13:08:02.819Z","repository":{"id":79669309,"uuid":"562939691","full_name":"beatlabs/ctxlog","owner":"beatlabs","description":"ctxlog is a library which helps to add a contextual data to your log messages at any time, and have it logged with each message.","archived":false,"fork":false,"pushed_at":"2022-11-08T09:51:39.000Z","size":2004,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T16:36:22.781Z","etag":null,"topics":["context","go","golang","log","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beatlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2022-11-07T15:17:48.000Z","updated_at":"2022-12-12T15:13:02.000Z","dependencies_parsed_at":"2023-05-14T11:00:33.744Z","dependency_job_id":null,"html_url":"https://github.com/beatlabs/ctxlog","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/beatlabs/ctxlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatlabs%2Fctxlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatlabs%2Fctxlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatlabs%2Fctxlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatlabs%2Fctxlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beatlabs","download_url":"https://codeload.github.com/beatlabs/ctxlog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatlabs%2Fctxlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274189075,"owners_count":25237875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"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":["context","go","golang","log","logging"],"created_at":"2025-09-08T13:07:54.743Z","updated_at":"2025-09-08T13:08:02.809Z","avatar_url":"https://github.com/beatlabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Context Logger ![CI](https://github.com/beatlabs/ctxlog/actions/workflows/ci.yml/badge.svg)\n\n`ctxlog` is a library which helps to add a contextual data to your log messages at any time, and have it logged with each message.\n\n## Short-term plans \n\n_TBD but be aware it might happen_\n\n- Remove dependency on Patron and replace it with some generic logger\n- Add examples in `examples/` folder\n\n## Install it\n\nTo add this library as a dependency of your project, run \n```shell\n$ go get github.com/beatlabs/ctxlog\n```\n\n## Usage examples\n\nInitiate a logger in a request context\n\n```go\nreq := \u0026http.Request{}\n\nctx := ctxlog.AddLoggerForRequest(req)\n```\n\nAdd some custom data to it\n```go\nctxlog.FromContext(ctx).Int(\"answer\", 42)\nctxlog.FromContext(ctx).Str(\"so\", \"long\")\nctxlog.FromContext(ctx).SubCtx(map[string]interface{}{\n    \"thanks_for\":  \"all the fish\",\n    \"planet\":      \"Earth\",\n    \"happened_on\": \"Thursday\",\n})\n```\n\nAnd log it\n```go\nctxlog.FromContext(ctx).Warnf(\"this %s has — or rather had — a %s, which was this: %s\", \"planet\", \"problem\",\n\t\"most of the people living on it were unhappy for pretty much all of the time\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatlabs%2Fctxlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeatlabs%2Fctxlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatlabs%2Fctxlog/lists"}