We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ginplus.go line35 parent = logger.NewTraceIDContext(parent, GetTraceID(c)) 中的 GetTraceID(c)这次调用为冗余操作
func NewContext(c *gin.Context) context.Context { parent := context.Background() if v := GetTraceID(c); v != "" { parent = icontext.NewTraceID(parent, v) parent = logger.NewTraceIDContext(parent, GetTraceID(c)) } if v := GetUserID(c); v != "" { parent = icontext.NewUserID(parent, v) parent = logger.NewUserIDContext(parent, v) } return parent }
首先感谢作者开源;另外,想请教下为什么这里要这么多层ctx(在只有traceID和userID且均为已知的情况下)?
The text was updated successfully, but these errors were encountered:
代码看的真仔细啊,同为为啥这么多层的ctx。。
Sorry, something went wrong.
已经修复👍。对于较为独立的模块来说,模块内应该拥有属于自己的上下文数据封装。在这里logger是作为独立模块引用的,所以要想在logger内使用相关业务数据,就需要在业务入口进行数据注入。
No branches or pull requests
ginplus.go line35 parent = logger.NewTraceIDContext(parent, GetTraceID(c)) 中的 GetTraceID(c)这次调用为冗余操作
首先感谢作者开源;另外,想请教下为什么这里要这么多层ctx(在只有traceID和userID且均为已知的情况下)?
The text was updated successfully, but these errors were encountered: