Files
runny 7ec21f35b0 chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、
Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。
今日开发的培训推送管理改动随后单独提交。
2026-11-16 18:12:23 +08:00

28 lines
902 B
Go

package container
import (
"io"
stdlog "log"
"time"
gormlogger "gorm.io/gorm/logger"
)
// gormSlowSQLThreshold is GORM's default slow-query threshold. Statements
// faster than this are not logged at Warn.
const gormSlowSQLThreshold = 200 * time.Millisecond
// newGormLogger is the application database logger. It matches GORM's
// default slow-SQL threshold (200ms), Warn level, and record-not-found
// handling. ParameterizedQueries is set so slow-query logs keep the SQL
// text and timing but omit bound values such as chunk text and vectors.
func newGormLogger(w io.Writer) gormlogger.Interface {
return gormlogger.New(stdlog.New(w, "\r\n", stdlog.LstdFlags), gormlogger.Config{
SlowThreshold: gormSlowSQLThreshold,
LogLevel: gormlogger.Warn,
IgnoreRecordNotFoundError: false,
Colorful: true,
ParameterizedQueries: true,
})
}