Fix change log level

This commit is contained in:
Jinzhu 2020-05-31 17:49:31 +08:00
parent 49310d0974
commit ae9e4f1dd8
2 changed files with 4 additions and 3 deletions

View File

@ -100,8 +100,9 @@ type logger struct {
// LogMode log mode
func (l *logger) LogMode(level LogLevel) Interface {
l.LogLevel = level
return l
newlogger := *l
newlogger.LogLevel = level
return &newlogger
}
// Info print info

View File

@ -20,7 +20,7 @@ func TestNamedPolymorphic(t *testing.T) {
DB.Save(&hamster)
hamster2 := Hamster{}
DB.Debug().Preload("PreferredToy").Preload("OtherToy").Find(&hamster2, hamster.Id)
DB.Preload("PreferredToy").Preload("OtherToy").Find(&hamster2, hamster.Id)
if hamster2.PreferredToy.ID != hamster.PreferredToy.ID || hamster2.PreferredToy.Name != hamster.PreferredToy.Name {
t.Errorf("Hamster's preferred toy failed to preload")