disable mgo debug

This commit is contained in:
Umputun
2019-02-02 23:46:38 -06:00
parent 72b60bf823
commit 58acbecf53
2 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -43,8 +43,10 @@ func NewServerWithURL(url string, timeout time.Duration) (res *Server, err error
func NewServer(dial mgo.DialInfo, params ServerParams) (res *Server, err error) {
result := Server{dial: dial, params: params}
mgo.SetDebug(params.Debug)
mgo.SetLogger(&mgdLogger{})
if params.Debug {
mgo.SetDebug(true)
mgo.SetLogger(&mgdLogger{})
}
if len(dial.Addrs) == 0 {
return nil, errors.New("missing mongo address")