1 Star 0 Fork 21

yuexudong / go-admin-core

forked from go-admin-team / go-admin-core 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
context.go 292 Bytes
一键复制 编辑 原始数据 按行查看 历史
lwnmengjing 提交于 2021-05-19 19:28 . feat :sparkles:优化logger使用
package logger
import "context"
type loggerKey struct{}
func FromContext(ctx context.Context) (*Helper, bool) {
l, ok := ctx.Value(&loggerKey{}).(*Helper)
return l, ok
}
func NewContext(ctx context.Context, l *Helper) context.Context {
return context.WithValue(ctx, &loggerKey{}, l)
}
Go
1
https://gitee.com/yuexudong/go-admin-core.git
git@gitee.com:yuexudong/go-admin-core.git
yuexudong
go-admin-core
go-admin-core
v1.4.4

搜索帮助