diff --git a/wrapper/gorm_v2.go b/wrapper/gorm_v2.go index ec34f3b..558fa40 100644 --- a/wrapper/gorm_v2.go +++ b/wrapper/gorm_v2.go @@ -9,6 +9,7 @@ package wrapper import ( "context" + "fmt" "strings" "time" @@ -175,6 +176,13 @@ func (g *Gorm) write(ctx context.Context, message string, level string, data map if nil == data { data = make(map[string]any) } + if nil != data["sql"] { + sqlStr := strings.TrimSpace(fmt.Sprintf("%v", data["sql"])) + sqlArr := strings.Split(sqlStr, " ") + if len(sqlArr) > 0 { + message = fmt.Sprintf("【%v】" + message) + } + } if nil == g.outCtx { g.outCtx = context.Background() }