Update gorm_pgsql.go

把慢sql日志级别从错误调整到告警
This commit is contained in:
Brandon-lz 2024-12-23 10:54:44 +08:00 committed by GitHub
parent c9d6ecd646
commit b073d61a15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -76,7 +76,8 @@ type SqlLogWriter struct{}
func (w *SqlLogWriter) Write(p []byte) (n int, err error) {
if strings.Contains(string(p), "SLOW SQL") {
global.GVA_LOG.Error("SLOW-SQL", zap.String("sql", string(p)))
global.GVA_LOG.Warn("SLOW-SQL", zap.String("sql", string(p)))
} else {
global.GVA_LOG.Info("NORMAL-SQL", zap.String("sql", string(p)))
}