Redirect db log into db.log file

This commit is contained in:
qowevisa 2024-11-08 17:05:23 +02:00
parent a0b96e25b2
commit ad25c69c79

View File

@ -25,8 +25,12 @@ func Connect() *gorm.DB {
if udb != nil {
return udb
}
logFile, err := os.OpenFile("db.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
newLogger := logger.New(
log.New(os.Stdout, "\r\n", log.LstdFlags),
log.New(logFile, "\r\n", log.LstdFlags),
logger.Config{
SlowThreshold: time.Second,
LogLevel: logger.Error,