feat: show gorm log on debug/dev mode (#2720)
This commit is contained in:
parent
e58ca686e3
commit
5a6b600ace
@ -19,11 +19,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func InitDB() {
|
func InitDB() {
|
||||||
|
logLevel := logger.Silent
|
||||||
|
if flags.Debug || flags.Dev {
|
||||||
|
logLevel = logger.Info
|
||||||
|
}
|
||||||
newLogger := logger.New(
|
newLogger := logger.New(
|
||||||
stdlog.New(log.StandardLogger().Out, "\r\n", stdlog.LstdFlags),
|
stdlog.New(log.StandardLogger().Out, "\r\n", stdlog.LstdFlags),
|
||||||
logger.Config{
|
logger.Config{
|
||||||
SlowThreshold: time.Second,
|
SlowThreshold: time.Second,
|
||||||
LogLevel: logger.Silent,
|
LogLevel: logLevel,
|
||||||
IgnoreRecordNotFoundError: true,
|
IgnoreRecordNotFoundError: true,
|
||||||
Colorful: true,
|
Colorful: true,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user