Skip to content

Commit

Permalink
add changelog and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-tacquet committed Feb 18, 2021
1 parent 00e0986 commit 36b24cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

## 1.0.0
### Added
- Gormlog library
- Example in readme
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# gormv2-logrus
Easily connect Gorm V2 and logrus with customizable options

Usage example :

```go
package test

import (
gormv2logrus "github.com/thomas-tacquet/gormv2-logrus"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)

func myFunctionToConnectOnMyDB(e *logrus.Entry) {
gormLogger := gormv2logrus.NewGormlog(gormv2logrus.WithLogrusEntry(e))
gormLogger.LogMode(logger.Error)

gormConfig := &gorm.Config{
Logger: gormLogger,
CreateBatchSize: 1500,
SkipDefaultTransaction: true,
}

db, err := gorm.Open(
"CONNEXION STRING",
gormConfig,
)
}
```

0 comments on commit 36b24cb

Please sign in to comment.