{"id":37118210,"url":"https://github.com/raahii/ecolog","last_synced_at":"2026-01-14T13:49:09.232Z","repository":{"id":64940518,"uuid":"579380874","full_name":"raahii/ecolog","owner":"raahii","description":"A simple echo middleware for application logs with request context","archived":false,"fork":false,"pushed_at":"2022-12-21T01:12:10.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-21T20:08:24.612Z","etag":null,"topics":["contextual-logging","echo","echo-framework","go","golang","logging"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/raahii/ecolog","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raahii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-17T14:02:02.000Z","updated_at":"2022-12-18T14:25:27.000Z","dependencies_parsed_at":"2023-01-30T02:15:54.920Z","dependency_job_id":null,"html_url":"https://github.com/raahii/ecolog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raahii/ecolog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raahii%2Fecolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raahii%2Fecolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raahii%2Fecolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raahii%2Fecolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raahii","download_url":"https://codeload.github.com/raahii/ecolog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raahii%2Fecolog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["contextual-logging","echo","echo-framework","go","golang","logging"],"created_at":"2026-01-14T13:49:08.374Z","updated_at":"2026-01-14T13:49:09.207Z","avatar_url":"https://github.com/raahii.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ecolog \n\n[![Go package](https://github.com/raahii/ecolog/actions/workflows/test.yml/badge.svg)](https://github.com/raahii/ecolog/actions/workflows/test.yml)\n\n\nEcolog provides a middleware for [Go Echo framework](https://echo.labstack.com/) to output application logs with request context.\n\nBy using ecolog and Echo's standard gommon logging, You can add fields related to HTTP request such as method, URI, Request ID, etc.\n```json\n{\n  \"time\": \"2022-12-18T22:22:21+09:00\",\n  \"level\": \"INFO\",\n  \"id\": \"5aWJKbZ1hEDYyfwhidOnUcD7zRyYHaIa\",\n  \"remote_ip\": \"127.0.0.1\",\n  \"host\": \"localhost:1323\",\n  \"method\": \"GET\",\n  \"uri\": \"/\",\n  \"user_agent\": \"curl/7.79.1\",\n  \"message\": \"This is a log in Hello method.\"\n}\n```\n\n\n\n## Installation\n\n```shell\ngo get -u github.com/raahii/ecolog\n```\n\n\n\n\n## Example\n\n1. Let's use ecolog middleware to override log format.\n\n  ```go\n  func main() {\n    e := echo.New()\n    \n    // Use ecolog middleware.\n    // See also ecolog.AppLoggerConfig doc.\n    e.Use(ecolog.AppLoggerWithConfig(ecolog.AppLoggerConfig{\n      Format: `{\"time\":\"${time_rfc3339}\",\"level\": \"${level}\",id\":\"${id}\",\"remote_ip\":\"${remote_ip}\",` +\n        `\"host\":\"${host}\",\"method\":\"${method}\",\"uri\":\"${uri}\",\"user_agent\":\"${user_agent}\"}`,\n    }))\n    \n    ...\n  }\n  ```\n\n\n\n2. Define an endpoint, and output application log with `echo.Context.Logger()` in your handler.\n\n  ```go\n  func Hello(c echo.Context) error {\n    c.Logger().Infof(\"This is a log in Hello method.\")\n    return c.JSON(http.StatusOK, \"Hello, World\")\n  }\n\n  func main() {\n    ...\n    e.GET(\"/\", Hello)\n    ...\n  }\n  ```\n\n\n\n3. Then, we can observe the application log with the request context.\n\n  ```shell\n  ❯ go run example/server.go\n  ⇨ http server started on [::]:1323\n  {\"time\":\"2022-12-18T22:22:21+09:00\",\"level\": \"INFO\",\"id\":\"5aWJKbZ1hEDYyfwhidOnUcD7zRyYHaIa\",\"remote_ip\":\"127.0.0.1\",\"host\":\"localhost:1323\",\"method\":\"GET\",\"uri\":\"/\",\"user_agent\":\"curl/7.79.1\",\"message\":\"This is a log in Hello method.\"}\n  ```\n\nSee [example/server.go](https://github.com/raahii/ecolog/blob/main/example/server.go) for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraahii%2Fecolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraahii%2Fecolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraahii%2Fecolog/lists"}