Use copy logger into itself instead of using parent's

This commit is contained in:
Jinzhu 2015-08-01 11:09:17 +08:00
parent bee1c8d119
commit 6f30170fec
2 changed files with 3 additions and 3 deletions

View File

@ -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 {

View File

@ -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{}) {