diff --git a/backend/Gopkg.lock b/backend/Gopkg.lock index 7f622280..d088decf 100644 --- a/backend/Gopkg.lock +++ b/backend/Gopkg.lock @@ -126,20 +126,20 @@ version = "v0.3.2" [[projects]] - digest = "1:779380833dce298899504f0b78ce961339cd5b5facb43f41208d2120d22306f5" + digest = "1:1933dabfb0e07548ed9684fdef857cc6f2413bbbb74ba838a7c1f77407b8fd90" name = "github.com/go-pkgz/lgr" packages = ["."] pruneopts = "UT" - revision = "dbe2f3c6c85e69d224b1dc5ea48d65521827ee8c" - version = "v0.2.1" + revision = "8f56fccc1a15dfe9c7f72e049fc87cc378205b97" + version = "v0.2.2" [[projects]] - digest = "1:1212e114344a5cdcc834ea69e19d456eef230f9784659080fee67e02ba2cb574" + digest = "1:c509e3f646c48148f2239fa66d5cd62785dfd057b5d2b46972e45b60049c19ed" name = "github.com/go-pkgz/mongo" packages = ["."] pruneopts = "UT" - revision = "9a09a574c336c6ae2338a65bbebed2baab2a713c" - version = "v1.0.0" + revision = "ee1e9a167094f8cdbc27407907aa694fff350ec3" + version = "v1.1.0" [[projects]] digest = "1:0f24c72d7e9bcb682b907be0461ac552973cd4b3f1b60b04b725f6d74a3e59e7" diff --git a/backend/vendor/github.com/go-pkgz/lgr/README.md b/backend/vendor/github.com/go-pkgz/lgr/README.md index 3f6a9a8d..875130db 100644 --- a/backend/vendor/github.com/go-pkgz/lgr/README.md +++ b/backend/vendor/github.com/go-pkgz/lgr/README.md @@ -7,7 +7,7 @@ ## usage ```go - l := lgr.New(lgr.Debug, lgr.Caller) // allow debug and caller info + l := lgr.New(lgr.Debug, lgr.CallerFile) // allow debug and caller file info l.Logf("INFO some important err message, %v", err) l.Logf("DEBUG some less important err message, %v", err) ``` @@ -18,7 +18,7 @@ output looks like this: 2018/01/07 13:02:34.015 DEBUG {svc/handler.go:155 h.MyFunc2} some less important err message, file is too small` ``` -_Without `lgr.Caller` it will drop `{caller}` part_ +_Without `lgr.CallerFile` it will drop `{caller}` part_ ## details @@ -33,7 +33,10 @@ _Without `lgr.Caller` it will drop `{caller}` part_ `lgr.New` call accepts functional options: - `lgr.Debug` - turn debug mode on. This allows messages with "DEBUG" level (filtered overwise) -- `lgr.Caller` - adds the caller info each message +- `lgr.CallerFile` - adds the caller file info each message +- `lgr.CallerFunc` - adds the caller function info each message +- `lgr.LevelBraces` - wraps levels with "[" and "]" +- `lgr.Msec` - adds milliseconds to timestamp - `lgr.Out(io.Writer)` - sets the output writer, default `os.Stdout` - `lgr.Err(io.Writer)` - sets the error writer, default `os.Stderr` @@ -44,5 +47,11 @@ _Without `lgr.Caller` it will drop `{caller}` part_ - `DEBUG` will be filtered unless `lgr.Debug` option defined - `INFO` and `WARN` don't have any special behavior attached - `ERROR` sends messages to both out and err writers -- "PANIC" and "FATAL" send messages to both out and err writers. In addition sends dump of callers and runtime info to err only, and call `os.Exit(1)`. - \ No newline at end of file +- `PANIC` and `FATAL` send messages to both out and err writers. In addition sends dump of callers and runtime info to err only, and call `os.Exit(1)`. + +### global logger + +Users should avoid global logger and pass the concrete logger as a dependency. However, in some cases global logger may be needed, for example migration from stdlib `log` to `lgr`. For such cases `log "github.com/go-pkgz/lgr"` can be imported instead of `log` package. + +Global logger provides `lgr.Printf`, `lgr.Print` and `lgr.Fatalf` functions. User can customize the logger by calling `lgr.Setup(options ...)`. The instance of this logger can be retried with `lgr.Default()` + \ No newline at end of file diff --git a/backend/vendor/github.com/go-pkgz/lgr/logger.go b/backend/vendor/github.com/go-pkgz/lgr/logger.go index 3832874f..5d1c6e5a 100644 --- a/backend/vendor/github.com/go-pkgz/lgr/logger.go +++ b/backend/vendor/github.com/go-pkgz/lgr/logger.go @@ -137,7 +137,7 @@ func (l *Logger) extractLevel(line string) (level, msg string) { return lv, line[len(lv)+3:] } } - return "", line + return "INFO", line } // getDump reads runtime stack and returns as a string diff --git a/backend/vendor/github.com/go-pkgz/mongo/.travis.yml b/backend/vendor/github.com/go-pkgz/mongo/.travis.yml index 6e8c06a7..dd9db1c6 100644 --- a/backend/vendor/github.com/go-pkgz/mongo/.travis.yml +++ b/backend/vendor/github.com/go-pkgz/mongo/.travis.yml @@ -1,23 +1,25 @@ language: go go: - - "1.10.x" + - "1.11.x" + +install: true go_import_path: github.com/go-pkgz/mongo services: mongodb before_install: - - cp -rf .vendor vendor + - export TZ=America/Chicago + - curl -L https://git.io/vp6lP | sh - go get github.com/mattn/goveralls - - go get gopkg.in/alecthomas/gometalinter.v2 - - $GOPATH/bin/gometalinter.v2 --install + - export MONGO_TEST=mongodb://127.0.0.1:27017 + - export PATH=$(pwd)/bin:$PATH -before_script: - - sleep 3 script: - - export MONGO_TEST=mongodb://127.0.0.1:27017 - - go test ./... - - $GOPATH/bin/gometalinter.v2 --exclude=test --exclude=mock --exclude=vendor ./... - - $GOPATH/bin/goveralls -service=travis-ci + - GO111MODULE=on go get ./... + - GO111MODULE=on go mod vendor + - GO111MODULE=on go test -v -mod=vendor -covermode=count -coverprofile=profile.cov ./... || travis_terminate 1; + - ./bin/gometalinter --deadline=120s --exclude=test --exclude=mock --exclude=vendor --exclude=_example --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=megacheck --enable=ineffassign --enable=varcheck --enable=unconvert --enable=deadcode --enable=interfacer --enable=gotype ./... || travis_terminate 1; + - $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/davecgh/go-spew/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index c8364161..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/LICENSE deleted file mode 100644 index 770c7672..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -mgo - MongoDB driver for Go - -Copyright (c) 2010-2013 - Gustavo Niemeyer - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/bson/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/bson/LICENSE deleted file mode 100644 index 89032601..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/bson/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -BSON library for Go - -Copyright (c) 2010-2012 - Gustavo Niemeyer - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/internal/json/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/internal/json/LICENSE deleted file mode 100644 index 74487567..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/globalsign/mgo/internal/json/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/pmezard/go-difflib/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/pmezard/go-difflib/LICENSE deleted file mode 100644 index c67dad61..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/pmezard/go-difflib/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013, Patrick Mezard -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - The names of its contributors may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/stretchr/testify/LICENSE b/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/stretchr/testify/LICENSE deleted file mode 100644 index 473b670a..00000000 --- a/backend/vendor/github.com/go-pkgz/mongo/.vendor/github.com/stretchr/testify/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell - -Please consider promoting this project if you find it useful. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/backend/vendor/github.com/go-pkgz/mongo/go.mod b/backend/vendor/github.com/go-pkgz/mongo/go.mod new file mode 100644 index 00000000..eed80f35 --- /dev/null +++ b/backend/vendor/github.com/go-pkgz/mongo/go.mod @@ -0,0 +1,9 @@ +module github.com/go-pkgz/mongo + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/globalsign/mgo v0.0.0-20180615134936-113d3961e731 + github.com/go-pkgz/lgr v0.2.2 + github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/testify v1.3.0 +) diff --git a/backend/vendor/github.com/go-pkgz/mongo/go.sum b/backend/vendor/github.com/go-pkgz/mongo/go.sum new file mode 100644 index 00000000..66ac0631 --- /dev/null +++ b/backend/vendor/github.com/go-pkgz/mongo/go.sum @@ -0,0 +1,17 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/globalsign/mgo v0.0.0-20180615134936-113d3961e731 h1:y7wyeiA6T+TT+HGC9DYypvLkUeg99N4rqHMzn2MmjYk= +github.com/globalsign/mgo v0.0.0-20180615134936-113d3961e731/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-pkgz/lgr v0.1.5 h1:oWj3VNlyYL2uUpdL6Gbi21BAH619Xb/8E78ozpyI2xo= +github.com/go-pkgz/lgr v0.1.5/go.mod h1:hBM1NM/SoYdlrykgdgJWGrZ/TM/XaZIjRbJfx7NkMm8= +github.com/go-pkgz/lgr v0.2.2 h1:HSOqMVoetAfvA40Gpy/X/HGyV0UUafIMPgp+SdZends= +github.com/go-pkgz/lgr v0.2.2/go.mod h1:hBM1NM/SoYdlrykgdgJWGrZ/TM/XaZIjRbJfx7NkMm8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/backend/vendor/github.com/go-pkgz/mongo/server.go b/backend/vendor/github.com/go-pkgz/mongo/server.go index 31d7c0c0..7aed5c6e 100644 --- a/backend/vendor/github.com/go-pkgz/mongo/server.go +++ b/backend/vendor/github.com/go-pkgz/mongo/server.go @@ -6,13 +6,12 @@ import ( "crypto/tls" "errors" "fmt" - "log" "net" - "os" "strings" "time" "github.com/globalsign/mgo" + log "github.com/go-pkgz/lgr" ) // Server represents mongo instance and provides session accessor @@ -27,11 +26,11 @@ type ServerParams struct { ConsistencyMode mgo.Mode Delay int // initial delay to give mongo server some time to start, in case if mongo part of the same compose Debug bool // turn on mgo debug mode - SSL bool + SSL bool // enforce SSL connection } // NewServerWithURL makes mongo server from url like -// mongodb://remark42:password@127.0.0.1t:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin +// mongodb://remark42:password@127.0.0.1:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin func NewServerWithURL(url string, timeout time.Duration) (res *Server, err error) { dial, params, err := parseURL(url, timeout) if err != nil { @@ -44,10 +43,8 @@ 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} - if params.Debug { - mgo.SetDebug(true) - mgo.SetLogger(log.New(os.Stdout, "MGO ", log.Ldate|log.Ltime|log.Lmicroseconds)) - } + mgo.SetDebug(true) + mgo.SetLogger(&mgdLogger{}) if len(dial.Addrs) == 0 { return nil, errors.New("missing mongo address") @@ -89,11 +86,11 @@ func NewServer(dial mgo.DialInfo, params ServerParams) (res *Server, err error) } // SessionCopy returns copy of main session. Client should close it -func (m Server) SessionCopy() *mgo.Session { +func (m *Server) SessionCopy() *mgo.Session { return m.sess.Copy() } -func (m Server) String() string { +func (m *Server) String() string { return fmt.Sprintf("%v%s", m.dial.Addrs, m.dial.Database) } @@ -110,8 +107,15 @@ func parseURL(mongoURL string, connectTimeout time.Duration) (mgo.DialInfo, Serv dial, err := mgo.ParseURL(mongoURL) if err != nil { - return mgo.DialInfo{}, ServerParams{}, fmt.Errorf("failed to pars mongo url %s, %s", mongoURL, err) + return mgo.DialInfo{}, ServerParams{}, fmt.Errorf("failed to parse mongo url %s, %s", mongoURL, err) } dial.Timeout = connectTimeout return *dial, params, nil } + +type mgdLogger struct{} + +func (l *mgdLogger) Output(calldepth int, s string) error { + log.Printf("[DEBUG] MGO %s", s) + return nil +} diff --git a/backend/vendor/github.com/go-pkgz/mongo/testing.go b/backend/vendor/github.com/go-pkgz/mongo/testing.go index d2cce4a9..089a478f 100644 --- a/backend/vendor/github.com/go-pkgz/mongo/testing.go +++ b/backend/vendor/github.com/go-pkgz/mongo/testing.go @@ -2,13 +2,13 @@ package mongo import ( "fmt" - "log" "os" "sync" "testing" "time" "github.com/globalsign/mgo" + log "github.com/go-pkgz/lgr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/backend/vendor/github.com/go-pkgz/mongo/writer.go b/backend/vendor/github.com/go-pkgz/mongo/writer.go index 722044db..0469e08e 100644 --- a/backend/vendor/github.com/go-pkgz/mongo/writer.go +++ b/backend/vendor/github.com/go-pkgz/mongo/writer.go @@ -3,11 +3,11 @@ package mongo import ( "context" "fmt" - "log" "sync" "time" "github.com/globalsign/mgo" + log "github.com/go-pkgz/lgr" ) // BufferedWriter defines interface for writes and flush