// 实现 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)) // 设置日志.
golang的mongodb显示执行的sql语句
最新推荐文章于 2025-04-20 19:07:16 发布