Sugared Gorm
Custom GORM logger implementation enhanced with SugarLogger for improved log level management and standardized log outputs.
Features
- Integrate GORM database logging with the powerful SugarLogger library.
- Easily manage log levels and control verbosity for debugging.
- Standardized and customizable log outputs for better readability and analysis.
Installation
Now you can add this package via;
go get -u github.com/erhanakp/sugaredgorm
Install godoc for documentation;
go install golang.org/x/tools/cmd/godoc@latest
Usage:
zap := zap.NewExample() gormLoggerValue := sugaredgorm.New(zap.Sugar(), sugaredgorm.Config{ SlowThreshold: 200 * time.Millisecond, Colorful: true, IgnoreRecordNotFoundError: true, ParameterizedQueries: true, }) _, err := gorm.Open(postgres.New(postgres.Config{ DSN: "host=localhost", }), &gorm.Config{ Logger: gormLoggerValue, })
Rake Tasks
rake -T rake bump[revision] # bump version, default is: patch rake doc[port] # run doc server rake lint # run golangci-lint rake publish[revision] # publish new version of the library, default is: patch rake test # run tests
Contributor(s)
- Erhan Akpınar - Creator, maintainer
- Uğur "vigo" Özyılmazel - Contributor
Contribute
All PR’s are welcome!
fork(https://github.com/erhanakp/sugaredgorm/fork)- Create your
branch(git checkout -b my-feature) commityours (git commit -am 'add some functionality')pushyourbranch(git push origin my-feature)- Than create a new Pull Request!
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
This project is licensed under MIT