feat: show gorm log on debug/dev mode (#2720)

This commit is contained in:
BoYanZh 2022-12-15 17:48:52 +08:00 committed by GitHub
parent e58ca686e3
commit 5a6b600ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,11 +19,15 @@ import (
)
func InitDB() {
logLevel := logger.Silent
if flags.Debug || flags.Dev {
logLevel = logger.Info
}
newLogger := logger.New(
stdlog.New(log.StandardLogger().Out, "\r\n", stdlog.LstdFlags),
logger.Config{
SlowThreshold: time.Second,
LogLevel: logger.Silent,
LogLevel: logLevel,
IgnoreRecordNotFoundError: true,
Colorful: true,
},