{"id":37395025,"url":"https://github.com/dtgorski/midas","last_synced_at":"2026-01-16T05:36:14.950Z","repository":{"id":57494720,"uuid":"210539760","full_name":"dtgorski/midas","owner":"dtgorski","description":"[MODULE] - Fast and cheap HTTP access logger middleware for Go crafted with special care in order to ensure marginal heap memory footprint and low garbage collector pressure.","archived":false,"fork":false,"pushed_at":"2019-09-24T07:31:21.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T05:45:22.497Z","etag":null,"topics":["access","decorator","go","golang","handler","http","log","logger","middleware","request"],"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/dtgorski.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-09-24T07:30:52.000Z","updated_at":"2024-06-19T05:45:22.498Z","dependencies_parsed_at":"2022-08-28T15:30:27.735Z","dependency_job_id":null,"html_url":"https://github.com/dtgorski/midas","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dtgorski/midas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtgorski%2Fmidas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtgorski%2Fmidas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtgorski%2Fmidas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtgorski%2Fmidas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtgorski","download_url":"https://codeload.github.com/dtgorski/midas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtgorski%2Fmidas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: 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":["access","decorator","go","golang","handler","http","log","logger","middleware","request"],"created_at":"2026-01-16T05:36:14.857Z","updated_at":"2026-01-16T05:36:14.925Z","avatar_url":"https://github.com/dtgorski.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/dtgorski/midas.svg?branch=master)](https://travis-ci.org/dtgorski/midas)\n[![Coverage Status](https://coveralls.io/repos/github/dtgorski/midas/badge.svg?branch=master)](https://coveralls.io/github/dtgorski/midas?branch=master)\n\n## midas\n\nFast and cheap HTTP access logger middleware for Go.\n\n### Installation\n```\ngo get -u github.com/dtgorski/midas\n```\n\n### midas.Logger\n... is a fast HTTP middleware for machine-readable response logging (_access.log_).\nSpecial care has been taken in order to ensure marginal heap memory footprint and low garbage collector pressure.\nThe customized output layout has been chosen due to a specific requirement. If you need a different layout, feel free to fork.\n\n#### Usage with a common router software:\n```\nimport \"github.com/dtgorski/midas\"\n.\n.\nrouter.Use(\n    midas.Logger(os.Stdout),\n    .\n    .\n)\n```\n\n#### Usage with handcrafted routing:\n```\npackage main\n\nimport (\n    \"io\"\n    \"log\"\n    \"net/http\"\n    \"os\"\n\n    \"github.com/dtgorski/midas\"\n)\n\nfunc main() {\n    handler := http.HandlerFunc(\n        func(w http.ResponseWriter, req *http.Request) {\n            io.WriteString(w, \"Hello, world!\\n\")\n        },\n    )\n    logger := midas.Logger(os.Stdout)\n    http.Handle(\"/\", logger(handler))\n\n    log.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n```\n\n#### Log output could look like:\n```\n0000-00-00T00:00:00+00:00 | 127.0.0.1 | - | GET /hello HTTP/1.1 | 200 | - | - | Mozilla/5.0 (X11; Linux… | - | - | 14 | 0.000 | -\n0000-00-00T00:00:00+00:00 | 127.0.0.1 | - | GET / HTTP/1.1 | 200 | - | - | Mozilla/5.0 (X11; Linux… | - | - | 14 | 0.000 | -\n0000-00-00T00:00:00+00:00 | 127.0.0.1 | - | GET / HTTP/1.1 | 200 | - | - | Mozilla/5.0 (X11; Linux… | - | - | 14 | 0.000 | -\n```\nA log line consists of fields separated by a pipe and is suffixed by a newline (```\\n```). Non-printable whitespace characters and UTF-8 runes will be replaced by a period sign (```.```). The fields in their order:\n* access time \n* remote address without port\n* remote user, if any\n* request method, path, protocol\n* response status code\n* referer, if any\n* forwarded for, if any\n* user agent, if any\n* SSL protocol, if any\n* SSL cipher, if any\n* bytes sent in response\n* request time in seconds, three fractional digits \n* request id, if any\n\nAlthough targeted for machine-reading (like log aggregators), the field values are padded with spaces for better human perception. \n\n#### Artificial benchmark:\n```\n$ make bench \nCGO_ENABLED=0 go test -run=^$ -bench=. -benchmem\ngoos: linux\ngoarch: amd64\npkg: github.com/dtgorski/midas\n\nBenchmarkLoggerConcatFullLine-8   2000000   850 ns/op   48 B/op   2 allocs/op\n```\n\n## License\n[MIT](https://opensource.org/licenses/MIT) - © dtg [at] lengo [dot] org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtgorski%2Fmidas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtgorski%2Fmidas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtgorski%2Fmidas/lists"}