mgo 设置了debug . 为true
有没有显示直接查询语句的api
mgo.SetDebug(true)
10个月后我谷歌居然找到了自己提的问题。。。
友情回答一下把
// 实现 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)) // 设置日志.
用 tcpdump 监听 MySQL 服务器 ip 和端口
回答
本文地址:H5W3 » 【go】mgo怎么显示查询语句