From db40830da2a5ab13fcf0c33c914f9b351d0f12d8 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sun, 9 Jan 2022 03:33:48 +0800 Subject: [PATCH] update --- store/db.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/store/db.go b/store/db.go index f1523a9..f7ef93e 100644 --- a/store/db.go +++ b/store/db.go @@ -99,8 +99,14 @@ 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 { + glog.LogMode(logger.Info) + } + s.config = &gorm.Config{ - Logger: logger.Default.LogMode(logger.Info), + Logger: glog, SkipDefaultTransaction: true, } if s.Prod {