go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

In logx, can we pass callerDepth to skip some callers?

Open huiwanggo opened this issue 2 years ago • 1 comments

我在 go-zero 中使用 gorm,我想自定义 gorm 的 Logger,使用 logx 打印 gorm 的日志。 按照 gorm 文档实现 Interface 接口,其中一个方法实现如图: image 打印日志 caller 不符合预期: image 请问有没有更好的方法?

huiwanggo avatar Sep 04 '22 09:09 huiwanggo

This requirement is indeed necessary. At present, there are many internal middlewares in zero, and there will be problems in using logx, which will block the real business caller.

MarkJoyMa avatar Sep 06 '22 10:09 MarkJoyMa