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 {
|
if udb != nil {
|
||||||
return udb
|
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(
|
newLogger := logger.New(
|
||||||
log.New(os.Stdout, "\r\n", log.LstdFlags),
|
log.New(logFile, "\r\n", log.LstdFlags),
|
||||||
logger.Config{
|
logger.Config{
|
||||||
SlowThreshold: time.Second,
|
SlowThreshold: time.Second,
|
||||||
LogLevel: logger.Error,
|
LogLevel: logger.Error,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user