diff --git a/logger/logger.go b/logger/logger.go index ae7c22c9..694adedc 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -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 diff --git a/tests/named_polymorphic_test.go b/tests/named_polymorphic_test.go index 7af548a4..95b8ec7d 100644 --- a/tests/named_polymorphic_test.go +++ b/tests/named_polymorphic_test.go @@ -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")