mirror of https://github.com/go-gorm/gorm.git
Use copy logger into itself instead of using parent's
This commit is contained in:
parent
bee1c8d119
commit
6f30170fec
2
main.go
2
main.go
|
@ -113,7 +113,7 @@ func (s *DB) Callback() *callback {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) SetLogger(l logger) {
|
func (s *DB) SetLogger(l logger) {
|
||||||
s.parent.logger = l
|
s.logger = l
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) LogMode(enable bool) *DB {
|
func (s *DB) LogMode(enable bool) *DB {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package gorm
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
func (s *DB) clone() *DB {
|
func (s *DB) clone() *DB {
|
||||||
db := DB{db: s.db, parent: s.parent, logMode: s.logMode, values: map[string]interface{}{}, Value: s.Value, Error: s.Error}
|
db := DB{db: s.db, parent: s.parent, logger: s.logger, logMode: s.logMode, values: map[string]interface{}{}, Value: s.Value, Error: s.Error}
|
||||||
|
|
||||||
for key, value := range s.values {
|
for key, value := range s.values {
|
||||||
db.values[key] = value
|
db.values[key] = value
|
||||||
|
@ -34,7 +34,7 @@ func (s *DB) err(err error) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) print(v ...interface{}) {
|
func (s *DB) print(v ...interface{}) {
|
||||||
s.parent.logger.(logger).Print(v...)
|
s.logger.(logger).Print(v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) log(v ...interface{}) {
|
func (s *DB) log(v ...interface{}) {
|
||||||
|
|
Loading…
Reference in New Issue