{"id":16095545,"url":"https://github.com/meowgorithm/babylogger","last_synced_at":"2025-03-18T06:31:08.197Z","repository":{"id":57497597,"uuid":"133853375","full_name":"meowgorithm/babylogger","owner":"meowgorithm","description":"A Go HTTP logger middleware, for babies","archived":false,"fork":false,"pushed_at":"2023-06-01T14:20:45.000Z","size":31,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T07:51:39.150Z","etag":null,"topics":["go","goji","logging","middleware"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/meowgorithm/babylogger","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/meowgorithm.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}},"created_at":"2018-05-17T18:31:12.000Z","updated_at":"2024-08-17T17:40:24.000Z","dependencies_parsed_at":"2023-07-17T19:02:17.500Z","dependency_job_id":null,"html_url":"https://github.com/meowgorithm/babylogger","commit_stats":null,"previous_names":["magicnumbers/babylogger"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fbabylogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fbabylogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fbabylogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fbabylogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meowgorithm","download_url":"https://codeload.github.com/meowgorithm/babylogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910381,"owners_count":20367537,"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":["go","goji","logging","middleware"],"created_at":"2024-10-09T17:06:20.777Z","updated_at":"2025-03-18T06:31:07.727Z","avatar_url":"https://github.com/meowgorithm.png","language":"Go","readme":"Babylogger\n==========\n\n[![GoDoc Badge](https://godoc.org/github.com/magicnumbers/babylogger?status.svg)](https://pkg.go.dev/github.com/meowgorithm/babylogger)\n\nA Go HTTP logger middleware, for babies.\n\n![Example image of Babylogger doing its logging](https://i.imgur.com/VGg7Wl6.png \"Babylogger doing its logging\")\n\nWe’ve used it with [Goji][goji] and the Go standard library, but it should work\nwith any multiplexer worth its salt. And by that we mean any multiplexer\ncompatible with the standard library.\n\nNote that ANSI escape sequences (read: colors) will be stripped from the output\nwhen the logger is not running in a terminal. For example, log files won't\ncontain any sort of ANSI intended for color output.\n\nAlso note that for accurate response time logging Babylogger should be the first middleware\ncalled.\n\n\n## Examples\n\n### Standard Library\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n    \"github.com/magicnumbers/babylogger\"\n)\n\nfunc main() {\n    http.Handle(\"/\", babylogger.Middleware(http.HandlerFunc(handler)))\n    http.ListenAndServe(\":8000\", nil)\n}\n\nhandler(w http.ResponseWriter, r *http.Request) {\n    fmt.FPrintln(w, \"Oh, hi, I didn’t see you there.\")\n}\n```\n\n### Goji\n\n```go\n\nimport (\n    \"fmt\"\n    \"net/http\"\n    \"github.com/magicnumbers/babylogger\"\n    \"goji.io\"\n    \"goji.io/pat\"\n)\n\nfunc main() {\n    mux := goji.NewMux()\n    mux.Use(babylogger.Middleware)\n    mux.HandleFunc(pat.Get(\"/\"), handler)\n    http.ListenAndServe(\":8000\", mux)\n}\n\nhandler(w http.ResponseWriter, r *http.Request) {\n    fmt.FPrintln(w, \"Oh hi, I didn’t see you there.\")\n}\n```\n\n\n## License\n\nMIT\n\n[goji]: http://goji.io\n[mattn]: https://github.com/mattn\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowgorithm%2Fbabylogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeowgorithm%2Fbabylogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowgorithm%2Fbabylogger/lists"}