// 实现 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)) // 设置日志.