Redirect db log into db.log file
This commit is contained in:
parent
a0b96e25b2
commit
ad25c69c79
6
db/db.go
6
db/db.go
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user