From fe8868b8febcd3ffa43103781ea1e2438d798c81 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Dec 2023 18:15:45 +0800 Subject: [PATCH] update --- utils/app/app.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utils/app/app.go b/utils/app/app.go index b37e8f3..f0839c6 100644 --- a/utils/app/app.go +++ b/utils/app/app.go @@ -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) @@ -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 } }