diff --git a/store/db.go b/store/db.go index d8e73e1..a53c3e0 100644 --- a/store/db.go +++ b/store/db.go @@ -100,14 +100,16 @@ func New(t DBTYPE) *Store { // Connect to db and store db connection to var DB func (s *Store) Connect() (db *gorm.DB, err error) { - // glog := logger.Default - // if zerolog.Level(viper.GetInt("log.level")) <= zerolog.DebugLevel { - // l.Debug().Msg("set gorm log level to info") - // glog.LogMode(logger.Info) - // } + var glog logger.Interface + if zerolog.Level(viper.GetInt("log.level")) <= zerolog.DebugLevel { + l.Debug().Msg("set gorm log level to info") + glog = logger.Default.LogMode(logger.Info) + } else { + glog = logger.Default + } s.config = &gorm.Config{ - Logger: logger.Default.LogMode(logger.Info), + Logger: glog, SkipDefaultTransaction: true, } if s.Prod {