{"id":20434431,"url":"https://github.com/wantedly/gorm-zap","last_synced_at":"2025-08-04T04:39:51.559Z","repository":{"id":57482398,"uuid":"104618349","full_name":"wantedly/gorm-zap","owner":"wantedly","description":"Alternative logging with zap for GORM ⚡️","archived":false,"fork":false,"pushed_at":"2023-12-15T17:58:11.000Z","size":19,"stargazers_count":30,"open_issues_count":5,"forks_count":23,"subscribers_count":79,"default_branch":"master","last_synced_at":"2025-07-22T03:08:15.918Z","etag":null,"topics":["golang","gorm","logging","orm","structured-logging","zap"],"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/wantedly.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-24T04:21:47.000Z","updated_at":"2022-07-26T06:02:49.000Z","dependencies_parsed_at":"2023-12-15T18:52:37.073Z","dependency_job_id":"5c871368-d77d-4578-8746-cb78d91eb20e","html_url":"https://github.com/wantedly/gorm-zap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wantedly/gorm-zap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantedly%2Fgorm-zap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantedly%2Fgorm-zap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantedly%2Fgorm-zap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantedly%2Fgorm-zap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wantedly","download_url":"https://codeload.github.com/wantedly/gorm-zap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantedly%2Fgorm-zap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268649876,"owners_count":24284197,"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-08-04T02:00:09.867Z","response_time":79,"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":["golang","gorm","logging","orm","structured-logging","zap"],"created_at":"2024-11-15T08:26:40.315Z","updated_at":"2025-08-04T04:39:51.521Z","avatar_url":"https://github.com/wantedly.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gormzap\n[![Build Status](https://travis-ci.org/wantedly/gorm-zap.svg?branch=master)](https://travis-ci.org/wantedly/gorm-zap)\n[![codecov](https://codecov.io/gh/wantedly/gorm-zap/branch/master/graph/badge.svg)](https://codecov.io/gh/wantedly/gorm-zap)\n[![GoDoc](https://godoc.org/github.com/wantedly/gorm-zap?status.svg)](https://godoc.org/github.com/wantedly/gorm-zap)\n[![license](https://img.shields.io/github/license/wantedly/gorm-zap.svg)](./LICENSE)\n\nAlternative logging with [zap](https://github.com/uber-go/zap) for [GORM](http://jinzhu.me/gorm) ⚡️\n\nIn comparison to gorm's default logger, `gormzap` is faster, reflection free, low allocations and no regex compilations.\n\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"github.com/jinzhu/gorm\"\n\t\"github.com/wantedly/gorm-zap\"\n)\n\nconst (\n\tdatabaseURL = \"postgres://postgres:@localhost/gormzap?sslmode=disable\"\n)\n\nfunc main() {\n\tlogger, err = zap.NewProduction()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdb, err := gorm.Open(\"postgres\", databaseURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.LogMode(true)\n\tdb.SetLogger(gormzap.New(logger))\n\n\t// ...\n}\n```\n\n\n## Performance\nAccording to our benchmark, `gormzap` makes DB operations at least 5% faster and reduce object allocations.\n\n### Simple insert query\n\n| Logger | Time | Object Allocated |\n| :--- | :---: | :---: |\n| default | 187940 ns/op | 494 allocs/op |\n| gormzap | 185383 ns/op | 475 allocs/op |\n\n### Simple select query\n\n| Logger | Time | Object Allocated |\n| :--- | :---: | :---: |\n| default | 169361 ns/op | 531 allocs/op |\n| gormzap | 151304 ns/op | 519 allocs/op |\n\n### Simple select query with 10 placeholders\n\n| Logger | Time | Object Allocated |\n| :--- | :---: | :---: |\n| default | 200632 ns/op | 720 allocs/op |\n| gormzap | 190732 ns/op | 645 allocs/op |\n\n### Simple select query with 100 placeholders\n\n| Logger | Time | Object Allocated |\n| :--- | :---: | :---: |\n| default | 444513 ns/op | 1723 allocs/op |\n| gormzap | 263098 ns/op | 1101 allocs/op |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwantedly%2Fgorm-zap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwantedly%2Fgorm-zap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwantedly%2Fgorm-zap/lists"}