{"id":39581794,"url":"https://github.com/farnasirim/hkit","last_synced_at":"2026-01-18T07:30:39.966Z","repository":{"id":64305809,"uuid":"95457672","full_name":"farnasirim/hkit","owner":"farnasirim","description":"An http toolkit containing useful utilities like seamless debug logging, painless caching, etc.","archived":false,"fork":false,"pushed_at":"2018-11-09T04:25:43.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T16:43:34.482Z","etag":null,"topics":["cache","go","golang","http","http-cache","logrus","toolkit","toolkits","utilities","utility","utility-library"],"latest_commit_sha":null,"homepage":"","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/farnasirim.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}},"created_at":"2017-06-26T14:50:57.000Z","updated_at":"2024-06-20T16:43:34.483Z","dependencies_parsed_at":"2023-01-15T10:30:40.732Z","dependency_job_id":null,"html_url":"https://github.com/farnasirim/hkit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/farnasirim/hkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farnasirim%2Fhkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farnasirim%2Fhkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farnasirim%2Fhkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farnasirim%2Fhkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farnasirim","download_url":"https://codeload.github.com/farnasirim/hkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farnasirim%2Fhkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28533165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":["cache","go","golang","http","http-cache","logrus","toolkit","toolkits","utilities","utility","utility-library"],"created_at":"2026-01-18T07:30:39.362Z","updated_at":"2026-01-18T07:30:39.959Z","avatar_url":"https://github.com/farnasirim.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HKIT\n\n`hkit` is an http toolkit which implements handy, easy to configure facades.\n\nTo Install, do as you would with go modules:\n\n```bash\nvgo get github.com/farnasirim/hkit\n```\nYou can use old fashioned `go get` too if you want.\n\n## Docs\n\nhkit currently implements utilities for the following use cases:\n- [Logging](#logging)\n\n### \u003ca name=\"logging\"\u003e\u003c/a\u003e Logging\n\nYou can use hkit.Logger with any `http.Handler` or `http.HandlerFunc` as easy as the following:\n#### net/http\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/farnasirim/hkit\"\n)\n\nfunc main() {\n\thandlerFunc := func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(`{\"x\": \"2\", \"y\": {\"a\": \"b\"}}`))\n\t}\n\n\twrappedHandler := hkit.NewLogger(handlerFunc)\n\n\thttp.ListenAndServe(\":8000\", wrappedHandler)\n}\n```\nAnd then\n```bash\ncurl localhost:8000 -d '{\"some\": \"json\"}'\n```\n\nwill result in\n```\nMethod: POST\nremote address: [::1]:39252\n\nContent-Type: application/x-www-form-urlencoded\nUser-Agent: curl/7.61.1\nAccept: */*\nContent-Length: 16\n\n{\"some\": \"json\"}\n\n{\"x\": \"2\", \"y\": {\"a\": \"b\"}}\n```\n\n#### logrus\nThis is the easiest way you can use hkit with logrus:\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\n\tlog \"github.com/Sirupsen/logrus\"\n\n\t\"github.com/colonelmo/hkit\"\n)\n\nfunc main() {\n\thandlerFunc := func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(`{\"x\": \"2\", \"y\": {\"a\": \"b\"}}`))\n\t}\n\n\tprettyLogWriter := log.StandardLogger().Writer()\n\n\twrappedHandler := hkit.NewLogger(handlerFunc).SetWriter(prettyLogWriter)\n\n\thttp.ListenAndServe(\":8000\", wrappedHandler)\n}\n```\n\nAnd the previous curl will result in:\n\u003cpre\u003e\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] Method: POST                                 \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] remote address: [::1]:39358                  \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021]                                              \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] User-Agent: curl/7.61.1                      \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] Accept: */*                                  \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] Content-Length: 16                           \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] Content-Type: application/x-www-form-urlencoded \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021]                                              \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021] {\u0026quot;some\u0026quot;: \u0026quot;json\u0026quot;}                             \n\u003cfont color=\"#00AAAA\"\u003eINFO\u003c/font\u003e[0021]   \u003c/pre\u003e\n\nbeing written to the stdout.\n\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarnasirim%2Fhkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarnasirim%2Fhkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarnasirim%2Fhkit/lists"}