0
点赞
收藏
分享

微信扫一扫

golang的mongodb显示执行的sql语句

醉倾城1 2022-06-20 阅读 31
// 实现 mongo.Logger 的接口
type MongoLog struct {
}

func (MongoLog)Output(calldepth int, s string) error {
log.SetFlags(log.Lshortfile)
return log.Output(calldepth,s)
}
mgo.SetDebug(true) // 设置DEBUG模式
mgo.SetLogger(new(MongoLog)) // 设置日志.


举报

相关推荐

0 条评论