Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Dec 21, 2023
1 parent 48b7840 commit fe8868b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions utils/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ func DatabaseInit(driver, dsn string, show_sql bool, prefix string) {
conn.SetTableMapper(tbMapper)
dbPrefix = prefix
}
if show_sql {
conn.ShowSQL(true)
} else {
conn.SetLogLevel(log.LOG_ERR)
}

logctx := xormlog.NewLogCtx(Logger)
conn.SetLogger(logctx)
Expand All @@ -166,6 +161,13 @@ func DatabaseInit(driver, dsn string, show_sql bool, prefix string) {
if err := conn.Ping(); err != nil {
Logger.Fatal(err)
}

if show_sql {
conn.ShowSQL(true)
conn.SetLogLevel(log.LOG_INFO)
} else {
conn.SetLogLevel(log.LOG_ERR)
}
database = conn
}
}
Expand Down

0 comments on commit fe8868b

Please sign in to comment.