From 1743c763d2ea21fd6baed108ab64a1dd9ff32d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?piexlMax=28=E5=A5=87=E6=B7=BC?= Date: Tue, 31 Dec 2024 10:48:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gorm=E7=9A=84debug=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=97=A0=E8=AE=BA=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E4=BA=86?= =?UTF-8?q?zap=E9=83=BD=E9=9C=80=E8=A6=81=E8=BE=93=E5=87=BA=E5=88=B0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/initialize/internal/gorm_logger_writer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/initialize/internal/gorm_logger_writer.go b/server/initialize/internal/gorm_logger_writer.go index d148e86035..9774c96350 100644 --- a/server/initialize/internal/gorm_logger_writer.go +++ b/server/initialize/internal/gorm_logger_writer.go @@ -18,6 +18,11 @@ func NewWriter(config config.GeneralDB) *Writer { // Printf 格式化打印日志 func (c *Writer) Printf(message string, data ...any) { + + // 当有日志时候均需要输出到控制台 + fmt.Printf(message, data...) + + // 当开启了zap的情况,会打印到日志记录 if c.config.LogZap { switch c.config.LogLevel() { case logger.Silent: