master
Evan Chen 2022-01-09 03:46:35 +08:00
parent 8af9ea376b
commit 9136b5ce70
1 changed files with 8 additions and 6 deletions

View File

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