如何使分叉的 GORM v1 打印完整路径的日志?

huangapple go评论89阅读模式
英文:

How to make forked GORM v1 print full path logs?

问题

屏幕截图:

由于数据库驱动程序的原因,我们不得不分叉 https://github.com/jinzhu/gorm(gorm v1)。现在 gorm 打印的日志没有完整的日志路径。你可以在屏幕截图中看到详细信息。

我们如何从 gorm 日志中获得正确的输出?

英文:

Screens:

We've had to fork https://github.com/jinzhu/gorm (gorm v1) because of database driver. And now gorm prints logs without full log path. You can see details in screenshots.

How can we make correct output from the gorm logs?

答案1

得分: 0

$GOPATH/src/your_git.com/test/gorm/utils.go

var goSrcRegexp = regexp.MustCompile(`jinzhu/gorm(@.*)?/.*.go`)
var goTestRegexp = regexp.MustCompile(`jinzhu/gorm(@.*)?/.*test.go`)

jinzhu/gorm 替换为你自己的

英文:

$GOPATH/src/your_git.com/test/gorm/utils.go

var goSrcRegexp = regexp.MustCompile(`jinzhu/gorm(@.*)?/.*.go`)
var goTestRegexp = regexp.MustCompile(`jinzhu/gorm(@.*)?/.*test.go`)

replace jinzhu/gorm with your own

huangapple
  • 本文由 发表于 2021年7月8日 15:10:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/68297098.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定