升级数据库日志, 增加sql类型

This commit is contained in:
白茶清欢 2024-07-25 13:51:15 +08:00
parent 8ae4053b24
commit 98eb52ae30

View File

@ -180,7 +180,7 @@ func (g *Gorm) write(ctx context.Context, message string, level string, data map
sqlStr := strings.TrimSpace(fmt.Sprintf("%v", data["sql"]))
sqlArr := strings.Split(sqlStr, " ")
if len(sqlArr) > 0 {
message = fmt.Sprintf("【%v】" + message)
data["sql_type"] = strings.ToUpper(sqlArr[0])
}
}
if nil == g.outCtx {