{"id":37105248,"url":"https://github.com/gol4ng/logger-http","last_synced_at":"2026-01-14T12:42:00.250Z","repository":{"id":39971142,"uuid":"225331502","full_name":"gol4ng/logger-http","owner":"gol4ng","description":"Gol4ng logger sub package for http","archived":false,"fork":false,"pushed_at":"2022-05-20T12:20:52.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T22:49:48.720Z","etag":null,"topics":["correlation-id","go","go-logger","golang","golang-logger","http","logger","middleware","tripperware"],"latest_commit_sha":null,"homepage":null,"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/gol4ng.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":"2019-12-02T09:07:46.000Z","updated_at":"2022-05-20T12:16:26.000Z","dependencies_parsed_at":"2022-08-28T02:00:53.307Z","dependency_job_id":null,"html_url":"https://github.com/gol4ng/logger-http","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/gol4ng/logger-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gol4ng%2Flogger-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gol4ng%2Flogger-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gol4ng%2Flogger-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gol4ng%2Flogger-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gol4ng","download_url":"https://codeload.github.com/gol4ng/logger-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gol4ng%2Flogger-http/sbom","scorecard":{"id":434346,"data":{"date":"2025-08-11","repo":{"name":"github.com/gol4ng/logger-http","commit":"42882ad3477c5a4512327a407419a5b7c45c9612"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":2,"reason":"Found 2/7 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T04:13:26.431Z","repository_id":39971142,"created_at":"2025-08-19T04:13:26.431Z","updated_at":"2025-08-19T04:13:26.431Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["correlation-id","go","go-logger","golang","golang-logger","http","logger","middleware","tripperware"],"created_at":"2026-01-14T12:41:59.427Z","updated_at":"2026-01-14T12:42:00.238Z","avatar_url":"https://github.com/gol4ng.png","language":"Go","readme":"# logger-http\n\n[![Build Status](https://travis-ci.org/gol4ng/logger-http.svg?branch=master)](https://travis-ci.org/gol4ng/logger-http)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gol4ng/logger-http)](https://goreportcard.com/report/github.com/gol4ng/logger-http)\n[![GoDoc](https://godoc.org/github.com/gol4ng/logger-http?status.svg)](https://godoc.org/github.com/gol4ng/logger-http)\n\nGol4ng logger sub package for logging http\nRelated package [gol4ng/logger](https://github.com/gol4ng/logger) and [gol4ng/httpware](https://github.com/gol4ng/httpware)  \n\n## Installation\n\n`go get -u github.com/gol4ng/logger-http`\n\n## Quick Start\n\nYou can refer at [gol4ng/httpware](https://github.com/gol4ng/httpware) documentation for the middleware/tripperware usage\n\n### Tripperware \n\nLog you're `http.Client` request\n\n```\n\u003cdebug\u003e http client gonna GET http://google.com {\"http_url\":\"http://google.com\",\"http_start_time\":\"2019-12-13T17:01:13+01:00\",\"http_kind\":\"client\",\"Correlation-Id\":\"yhyBI94zyl\",\"http_header\":{\"Correlation-Id\":[\"yhyBI94zyl\"]},\"http_method\":\"GET\"}\n\u003cinfo\u003e http client GET http://google.com [status_code:301, duration:39.70726ms, content_length:219] {\"Correlation-Id\":\"yhyBI94zyl\",\"http_start_time\":\"2019-12-13T17:01:13+01:00\",\"http_method\":\"GET\",\"http_duration\":0.03970726,\"http_response_length\":219,\"http_header\":{\"Correlation-Id\":[\"yhyBI94zyl\"]},\"http_url\":\"http://google.com\",\"http_status\":\"301 Moved Permanently\",\"http_status_code\":301,\"http_kind\":\"client\"}\n\u003cdebug\u003e http client gonna GET http://www.google.com/ {\"http_kind\":\"client\",\"Correlation-Id\":\"uQzaMO9JC0\",\"http_header\":{\"Correlation-Id\":[\"uQzaMO9JC0\"],\"Referer\":[\"http://google.com\"]},\"http_method\":\"GET\",\"http_url\":\"http://www.google.com/\",\"http_start_time\":\"2019-12-13T17:01:13+01:00\"}\n\u003cinfo\u003e http client GET http://www.google.com/ [status_code:200, duration:72.582736ms, content_length:-1] {\"Correlation-Id\":\"uQzaMO9JC0\",\"http_header\":{\"Correlation-Id\":[\"uQzaMO9JC0\"],\"Referer\":[\"http://google.com\"]},\"http_method\":\"GET\",\"http_kind\":\"client\",\"http_response_length\":-1,\"http_duration\":0.072582736,\"http_status_code\":200,\"http_url\":\"http://www.google.com/\",\"http_start_time\":\"2019-12-13T17:01:13+01:00\",\"http_status\":\"200 OK\"}\n```\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/gol4ng/httpware/v4\"\n\t\"github.com/gol4ng/logger\"\n\t\"github.com/gol4ng/logger-http/tripperware\"\n\t\"github.com/gol4ng/logger/formatter\"\n\t\"github.com/gol4ng/logger/handler\"\n)\n\nfunc main(){\n\t// logger will print on STDOUT with default line format\n\tmyLogger := logger.NewLogger(handler.Stream(os.Stdout, formatter.NewDefaultFormatter()))\n\n\tclientStack := httpware.TripperwareStack(\n\t\ttripperware.InjectLogger(myLogger),\n\t\ttripperware.CorrelationId(),\n\t\ttripperware.Logger(myLogger),\n\t)\n\n\tc := http.Client{\n\t\tTransport: clientStack.DecorateRoundTripper(http.DefaultTransport),\n\t}\n\n\tc.Get(\"http://google.com\")\n\t// Will log\n\t//\u003cinfo\u003e http client GET http://google.com [status_code:301, duration:27.524999ms, content_length:219] {\"http_duration\":0.027524999,\"http_status\":\"301 Moved Permanently\",\"http_status_code\":301,\"http_response_length\":219,\"http_method\":\"GET\",\"http_url\":\"http://google.com\",\"http_start_time\":\"2019-12-03T10:47:38+01:00\",\"http_kind\":\"client\"}\n\t//\u003cinfo\u003e http client GET http://www.google.com/ [status_code:200, duration:51.047002ms, content_length:-1] {\"http_kind\":\"client\",\"http_duration\":0.051047002,\"http_status\":\"200 OK\",\"http_status_code\":200,\"http_response_length\":-1,\"http_method\":\"GET\",\"http_url\":\"http://www.google.com/\",\"http_start_time\":\"2019-12-03T10:47:38+01:00\"}\n}\n```\n\n### Middleware\nLog you're incoming http server request\n\n```\n\u003cdebug\u003e http server received GET / {\"http_url\":\"/\",\"http_start_time\":\"2019-12-13T17:15:30+01:00\",\"http_kind\":\"server\",\"Correlation-Id\":\"SBeEdhRhUl\",\"http_header\":{\"Accept-Encoding\":[\"gzip\"],\"Correlation-Id\":[\"SBeEdhRhUl\"],\"User-Agent\":[\"Go-http-client/1.1\"]},\"http_method\":\"GET\"}\n\u003cinfo\u003e handler log info {\"Correlation-Id\":\"SBeEdhRhUl\"}\n\u003cinfo\u003e http server GET / [status_code:200, duration:290.156µs, content_length:0] {\"http_kind\":\"server\",\"http_duration\":0.000290156,\"http_status_code\":200,\"Correlation-Id\":\"SBeEdhRhUl\",\"http_method\":\"GET\",\"http_url\":\"/\",\"http_start_time\":\"2019-12-13T17:15:30+01:00\",\"http_status\":\"OK\",\"http_response_length\":0,\"http_header\":{\"Accept-Encoding\":[\"gzip\"],\"Correlation-Id\":[\"SBeEdhRhUl\"],\"User-Agent\":[\"Go-http-client/1.1\"]}}\n```\n\n```go\npackage main\n     \n     import (\n     \t\"context\"\n     \t\"net\"\n     \t\"net/http\"\n     \t\"os\"\n     \n     \t\"github.com/gol4ng/httpware/v4\"\n     \t\"github.com/gol4ng/logger\"\n     \t\"github.com/gol4ng/logger-http/middleware\"\n     \t\"github.com/gol4ng/logger/formatter\"\n     \t\"github.com/gol4ng/logger/handler\"\n     )\n     \n     func main() {\n     \taddr := \":5001\"\n     \n     \tmyLogger := logger.NewLogger(\n     \t\thandler.Stream(os.Stdout, formatter.NewDefaultFormatter()),\n     \t)\n     \n     \t// we recommend to use MiddlewareStack to simplify managing all wanted middlewares\n     \t// caution middleware order matters\n     \tstack := httpware.MiddlewareStack(\n     \t\t//middleware.InjectLogger(myLogger), // we recommend to use http.Server.BaseContext instead of this middleware\n     \t\tmiddleware.CorrelationId(),\n     \t\tmiddleware.Logger(myLogger),\n     \t)\n     \n     \th := http.HandlerFunc(func(writer http.ResponseWriter, innerRequest *http.Request) {\n     \t\tl := logger.FromContext(innerRequest.Context(), myLogger)\n     \t\tl.Info(\"handler log info\", nil)\n     \t})\n     \n     \tserver := http.Server{\n     \t\tAddr:    addr,\n     \t\tHandler: stack.DecorateHandler(h),\n     \t\tBaseContext: func(listener net.Listener) context.Context {\n     \t\t\treturn logger.InjectInContext(context.Background(), myLogger)\n     \t\t},\n     \t}\n     \n     \tgo func() {\n     \t\tif err := server.ListenAndServe(); err != nil {\n     \t\t\tpanic(err)\n     \t\t}\n     \t}()\n     \n     \thttp.Get(\"http://localhost\" + addr)\n     \n     \t//\u003cdebug\u003e http server received GET / {\"Correlation-Id\":\"zEDWO9gmZ6\",\"http_header\":{\"Accept-Encoding\":[\"gzip\"],\"Correlation-Id\":[\"zEDWO9gmZ6\"],\"User-Agent\":[\"Go-http-client/1.1\"]},\"http_method\":\"GET\",\"http_url\":\"/\",\"http_start_time\":\"2019-12-13T17:05:53+01:00\",\"http_kind\":\"server\"}\n     \t//\u003cinfo\u003e handler log info {\"Correlation-Id\":\"zEDWO9gmZ6\"}\n     \t//\u003cinfo\u003e http server GET / [status_code:200, duration:232.491µs, content_length:0] {\"Correlation-Id\":\"zEDWO9gmZ6\",\"http_header\":{\"Accept-Encoding\":[\"gzip\"],\"Correlation-Id\":[\"zEDWO9gmZ6\"],\"User-Agent\":[\"Go-http-client/1.1\"]},\"http_method\":\"GET\",\"http_url\":\"/\",\"http_start_time\":\"2019-12-13T17:05:53+01:00\",\"http_duration\":0.000232491,\"http_status\":\"OK\",\"http_status_code\":200,\"http_kind\":\"server\",\"http_response_length\":0}\n     }\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgol4ng%2Flogger-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgol4ng%2Flogger-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgol4ng%2Flogger-http/lists"}