{"id":19421597,"url":"https://github.com/kochava/clog","last_synced_at":"2026-06-08T23:01:30.061Z","repository":{"id":48233510,"uuid":"183343639","full_name":"Kochava/clog","owner":"Kochava","description":"Simple contextual logger for Go","archived":false,"fork":false,"pushed_at":"2021-08-04T15:31:16.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-02-25T04:15:43.524Z","etag":null,"topics":["golang","logger","logging","tf","zap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kochava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-25T02:45:19.000Z","updated_at":"2021-08-04T15:31:18.000Z","dependencies_parsed_at":"2022-09-21T04:04:18.091Z","dependency_job_id":null,"html_url":"https://github.com/Kochava/clog","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Kochava/clog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kochava%2Fclog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kochava%2Fclog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kochava%2Fclog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kochava%2Fclog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kochava","download_url":"https://codeload.github.com/Kochava/clog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kochava%2Fclog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34083848,"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-08T02:00:07.615Z","response_time":111,"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":["golang","logger","logging","tf","zap"],"created_at":"2024-11-10T13:29:02.408Z","updated_at":"2026-06-08T23:01:30.027Z","avatar_url":"https://github.com/Kochava.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"clog\n===\n\n[![GoDoc](https://godoc.org/github.com/Kochava/clog?status.svg)](https://godoc.org/github.com/Kochava/clog)\n\n    go get github.com/Kochava/clog\n\nclog is a simple package for initializing a [Zap][] logger and attaching it to\na context, along with functions for logging from the context-attached logger or\nassociating new fields to the logger.\n\nGenerally speaking this is a bad use of the context package, but utility won out\nover passing both a context and a logger around all the time. In particular,\nthis is useful for passing a request-scoped logger through different\nhttp.Handler implementations that otherwise do not support Zap.\n\n[Zap]: https://go.uber.org/zap\n\n\nUsage\n---\n\nA few examples of basic usage follow.\n\n### Initialize a logger\n\n```go\n// Create a logger at info level with a production configuration.\nlevel := zap.NewAtomicLevelAt(zap.InfoLevel)\nl, err := clog.New(level, false)\nif err != nil {\n    panic(err)\n}\nl.Info(\"Ready\")\n```\n\n### Attach a logger to a context\n\n```go\n// var l *zap.Logger\n\n// Attach the logger, l, to a context:\nctx := clog.WithLogger(context.Background(), l)\n\n// Attach fields to the logger:\nctx = clog.With(ctx, zap.Int(\"field\", 1234))\n\n// Log at info level:\nclog.Info(ctx, \"Log message\")\n```\n\n\nLicense\n---\n\nclog is made available under the ISC license. A copy of it can be found in the\nrepository in the `COPYING` file.\n\n\n## Default Branch\n\nAs of October 1, 2020, github.com uses the branch name ‘main’ when creating the initial default branch for all new repositories.  In order to minimize any customizations in our github usage and to support consistent naming conventions, we have made the decision to rename the ‘master’ branch to be called ‘main’ in all Kochava’s github repos.\n\nFor local copies of the repo, the following steps will update to the new default branch:\n\n```\ngit branch -m master main\ngit fetch origin\ngit branch -u origin/main main\ngit remote set-head origin -a\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkochava%2Fclog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkochava%2Fclog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkochava%2Fclog/lists"}