{"id":20238426,"url":"https://github.com/smallstep/logging","last_synced_at":"2025-07-26T13:35:54.210Z","repository":{"id":39878968,"uuid":"243849860","full_name":"smallstep/logging","owner":"smallstep","description":"Log with confidence","archived":false,"fork":false,"pushed_at":"2025-05-26T13:56:03.000Z","size":276,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-26T14:59:36.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/smallstep.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":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-28T20:35:15.000Z","updated_at":"2025-05-26T13:56:06.000Z","dependencies_parsed_at":"2023-10-16T22:40:21.212Z","dependency_job_id":"ae8ad492-44cb-4782-a8d4-7fa5044c388e","html_url":"https://github.com/smallstep/logging","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/smallstep/logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Flogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Flogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Flogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Flogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallstep","download_url":"https://codeload.github.com/smallstep/logging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Flogging/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267175411,"owners_count":24047840,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"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":[],"created_at":"2024-11-14T08:34:07.879Z","updated_at":"2025-07-26T13:35:54.169Z","avatar_url":"https://github.com/smallstep.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logging\n\n[![GoDoc](https://img.shields.io/static/v1?label=godoc\u0026message=reference\u0026color=blue)](https://pkg.go.dev/github.com/smallstep/logging)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nLogging is a collection of collection of packages to make easy the logging experience.\n\nLogging is currently in active development and it's API WILL CHANGE WITHOUT NOTICE.\n\n## logging/httplog - the HTTP middleware\n\nHttplog implements and HTTP middleware that can optionally log the raw request and responses.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net/http\"\n\n    \"github.com/smallstep/logging\"\n    \"github.com/smallstep/logging/httplog\"\n)\n\nfunc main() {\n    logger, err := logging.New(\"scim\",\n        logging.WithLogResponses(),\n        logging.WithLogRequests(),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    http.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        fmt.Fprintln(w, \"Hello World!\")\n    })\n\n    srv := \u0026http.Server{\n        Addr:    \":8080\",\n        Handler: httplog.Middleware(logger, http.DefaultServeMux),\n        ErrorLog: logger.StdLogger(logging.ErrorLevel),\n    }\n\n    logger.Infof(\"start listening at %s.\", srv.Addr)\n    log.Fatal(srv.ListenAndServe())\n}\n```\n\nA simple `curl http://localhost:8080` will print the following logs:\n\n```sh\n$ go run examples/httplog.go\n{\"level\":\"info\",\"ts\":1582944317.382856,\"caller\":\"logging/logger.go:87\",\"msg\":\"start listening at :8080.\"}\n{\"level\":\"info\",\"ts\":1582944330.861353,\"caller\":\"httplog/handler.go:121\",\"msg\":\"\",\"name\":\"scim\",\"request-id\":\"bpct0ijipt3avli7utp0\",\"remote-address\":\"::1\",\"time\":\"2020-02-28T18:45:30-08:00\",\"duration\":0.000064785,\"duration-ns\":64785,\"method\":\"GET\",\"path\":\"/\",\"protocol\":\"HTTP/1.1\",\"status\":200,\"size\":13,\"referer\":\"\",\"user-agent\":\"curl/7.64.1\",\"request\":\"R0VUIC8gSFRUUC8xLjENCkhvc3Q6IGxvY2FsaG9zdDo4MDgwDQpBY2NlcHQ6ICovKg0KVXNlci1BZ2VudDogY3VybC83LjY0LjENClgtVHJhY2UtSWQ6IGJwY3QwaWppcHQzYXZsaTd1dHAwDQoNCg==\",\"response\":\"SGVsbG8gV29ybGQhCg==\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallstep%2Flogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallstep%2Flogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallstep%2Flogging/lists"}