feat(core): 统一 SQL 驱动诊断与 HTTP 启停分析能力
Verify / verify (push) Canceled after 0s

This commit is contained in:
zhangdeman committed 2026-11-28 02:06:19 -08:00
1 parent dcd47bf6e7
commit 351defec7b
8 files changed
+362 -6

No files matched your search

+10
View File
@@ -11,6 +11,7 @@ import (
"git.zhangdeman.cn/zhangdeman/ginframework/logger/storagevalue"
"git.zhangdeman.cn/zhangdeman/ginframework/diagnostic"
mysqlDriver "github.com/go-sql-driver/mysql"
"go.uber.org/zap"
"gorm.io/gorm"
gormLogger "gorm.io/gorm/logger"
@@ -110,6 +111,15 @@ func (l *Logger) Trace(ctx context.Context, begin time.Time, query func() (strin
}
fields = append(fields, storagevalue.Diagnostics(ctx)...)
if err != nil {
var (
mysqlError *mysqlDriver.MySQLError
)
if errors.As(err, &mysqlError) {
fields = append(fields, zap.Uint16("mysql_error_number", mysqlError.Number))
if mysqlError.SQLState != [5]byte{} {
fields = append(fields, zap.String("mysql_sql_state", string(mysqlError.SQLState[:])))
}
}
l.instance.Error("SQL execution failed", fields...)
return
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.