db instance add method WithLogger
This commit is contained in:
parent
9b0ad4730f
commit
11ceb74551
8
gorm.go
8
gorm.go
@ -203,6 +203,14 @@ func (db *DB) WithContext(ctx context.Context) *DB {
|
|||||||
return db.Session(&Session{WithConditions: true, Context: ctx})
|
return db.Session(&Session{WithConditions: true, Context: ctx})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithLogger change current instance db's Logger to l
|
||||||
|
func (db *DB) WithLogger(l logger.Interface) *DB {
|
||||||
|
return db.Session(&Session{
|
||||||
|
WithConditions: true,
|
||||||
|
Logger: l,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Debug start debug mode
|
// Debug start debug mode
|
||||||
func (db *DB) Debug() (tx *DB) {
|
func (db *DB) Debug() (tx *DB) {
|
||||||
return db.Session(&Session{
|
return db.Session(&Session{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user