{"id":16839472,"url":"https://github.com/simonpasquier/klog-gokit","last_synced_at":"2025-06-20T21:35:02.042Z","repository":{"id":34454211,"uuid":"162700253","full_name":"simonpasquier/klog-gokit","owner":"simonpasquier","description":"Replacement for klog for projects using the go-kit logger","archived":false,"fork":false,"pushed_at":"2024-08-19T09:17:31.000Z","size":69,"stargazers_count":3,"open_issues_count":3,"forks_count":10,"subscribers_count":3,"default_branch":"v3","last_synced_at":"2025-04-08T23:36:47.946Z","etag":null,"topics":["gokit-log","klog","kubernetes"],"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/simonpasquier.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":"2018-12-21T10:22:09.000Z","updated_at":"2024-08-19T09:17:35.000Z","dependencies_parsed_at":"2023-12-21T19:03:27.699Z","dependency_job_id":"d46a6992-504f-4e19-bcea-aad5f5337e54","html_url":"https://github.com/simonpasquier/klog-gokit","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/simonpasquier/klog-gokit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonpasquier%2Fklog-gokit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonpasquier%2Fklog-gokit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonpasquier%2Fklog-gokit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonpasquier%2Fklog-gokit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonpasquier","download_url":"https://codeload.github.com/simonpasquier/klog-gokit/tar.gz/refs/heads/v3","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonpasquier%2Fklog-gokit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261020662,"owners_count":23098200,"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","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":["gokit-log","klog","kubernetes"],"created_at":"2024-10-13T12:32:23.856Z","updated_at":"2025-06-20T21:34:57.032Z","avatar_url":"https://github.com/simonpasquier.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# klog-gokit [![CircleCI](https://circleci.com/gh/simonpasquier/klog-gokit.svg?style=svg)](https://circleci.com/gh/simonpasquier/klog-gokit)\n\nThis package is a replacement for [k8s.io/klog/v2](https://github.com/kubernetes/klog)\nin projects that use the [github.com/go-kit/log](https://pkg.go.dev/github.com/go-kit/log) module for logging.\n\n*The current branch supports neither\n[k8s.io/klog](https://pkg.go.dev/k8s.io/klog) nor\n[github.com/go-kit/kit](https://pkg.go.dev/github.com/go-kit/kit). Please use the `v2.1.0`\nversion instead.*\n\nIt is heavily inspired by the [`github.com/kubermatic/glog-gokit`](https://github.com/kubermatic/glog-gokit) package.\n\n## Usage\n\nAdd this line to your `go.mod` file:\n\n```\nreplace k8s.io/klog/v2 =\u003e github.com/simonpasquier/klog-gokit/v3 v3\n```\n\nIn your `main.go`:\n```go\n// Import the package like it is original klog\nimport (\n    ...\n    \"github.com/go-kit/log\"\n    klog \"k8s.io/klog/v2\"\n    ...\n)\n\n// Create go-kit logger in your main.go\nlogger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout))\nlogger = log.With(logger, \"ts\", log.DefaultTimestampUTC)\nlogger = log.With(logger, \"caller\", log.DefaultCaller)\nlogger = level.NewFilter(logger, level.AllowAll())\n\n// Overriding the default klog with our go-kit klog implementation.\n// Thus we need to pass it our go-kit logger object.\nklog.SetLogger(logger)\n```\n\nSetting the klog's logger **MUST** happen at the very beginning of your program\n(e.g. before using the other klog functions).\n\n## Function Levels\n\n|     klog     | gokit |\n| ------------ | ----- |\n| Info         | Debug |\n| InfoDepth    | Debug |\n| Infof        | Debug |\n| Infoln       | Debug |\n| InfoS        | Debug |\n| InfoSDepth   | Debug |\n| Warning      | Warn  |\n| WarningDepth | Warn  |\n| Warningf     | Warn  |\n| Warningln    | Warn  |\n| Error        | Error |\n| ErrorDepth   | Error |\n| Errorf       | Error |\n| Errorln      | Error |\n| Exit         | Error |\n| ExitDepth    | Error |\n| Exitf        | Error |\n| Exitln       | Error |\n| Fatal        | Error |\n| FatalDepth   | Error |\n| Fatalf       | Error |\n| Fatalln      | Error |\n\nThis table is rather opinionated and build for use with the Kubernetes' [Go client](https://github.com/kubernetes/client-go).\n\n## Disclaimer\n\nThis project doesn't aim at covering the complete `klog` API. That being said, it should work ok for\nprojects that use `k8s.io/client-go` (like [Prometheus](https://github.com/prometheus/prometheus) for instance).\n\n## Limitations\n\nThe module implements the `klog.Context(context.Context)`, `klog.Background()` and `klog.TODO()` functions but they all return a zero-value `Logger` which drops all log messages.\n\n## License\n\nApache License 2.0, see [LICENSE](https://github.com/simonpasquier/klog-gokit/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonpasquier%2Fklog-gokit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonpasquier%2Fklog-gokit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonpasquier%2Fklog-gokit/lists"}