From 43b03614be664380e146bdcbff368d9364176bae Mon Sep 17 00:00:00 2001 From: adamstruck Date: Tue, 1 Oct 2019 09:06:00 -0700 Subject: [PATCH] create grip logger package, allows passing configured logger to subprocesses --- cmd/kvload/main.go | 4 +- cmd/load/example/main.go | 2 +- cmd/load/main.go | 4 +- cmd/mongoload/main.go | 2 +- cmd/rdf/main.go | 2 +- cmd/server/main.go | 4 +- cmd/stream/main.go | 2 +- config/config.go | 5 +- elastic/graph.go | 2 +- elastic/graphdb.go | 2 +- elastic/index.go | 2 +- elastic/util.go | 2 +- engine/core/processors.go | 2 +- engine/pipes.go | 2 +- existing-sql/graph.go | 4 +- go.sum | 54 +++++++++++++ graphql/handler.go | 2 +- gripql/client.go | 2 +- jsengine/v8/v8.go | 2 +- jsonpath/jsonpath.go | 2 +- kvgraph/graph.go | 2 +- kvgraph/index.go | 2 +- kvgraph/schema.go | 2 +- kvi/badgerdb/badger_store.go | 6 +- kvi/boltdb/bolt_store.go | 2 +- kvi/leveldb/level_store.go | 2 +- kvindex/kvindex.go | 4 +- {config => log}/logger.go | 151 ++++++++++++++++++++++++++++++----- main.go | 4 +- mongo/compile.go | 2 +- mongo/graph.go | 2 +- mongo/graphdb.go | 2 +- mongo/has_evaluator.go | 2 +- mongo/index.go | 4 +- mongo/processor.go | 2 +- mongo/schema.go | 2 +- protoutil/protoutil.go | 2 +- psql/graph.go | 2 +- psql/graphdb.go | 2 +- server/api.go | 2 +- server/server.go | 4 +- util/file_reader.go | 2 +- util/insert.go | 2 +- 43 files changed, 237 insertions(+), 73 deletions(-) rename {config => log}/logger.go (57%) diff --git a/cmd/kvload/main.go b/cmd/kvload/main.go index 2ccb241a..e961c1ec 100644 --- a/cmd/kvload/main.go +++ b/cmd/kvload/main.go @@ -9,9 +9,9 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/kvgraph" "github.com/bmeg/grip/kvi" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util" "github.com/paulbellamy/ratecounter" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -106,7 +106,7 @@ var Cmd = &cobra.Command{ edgeCounter := ratecounter.NewRateCounter(10 * time.Second) for _, edgeFile := range edgeFileArray { - log.Printf("Loading %s", edgeFile) + log.Infof("Loading %s", edgeFile) count := 0 for e := range util.StreamEdgesFromFile(edgeFile) { graphChan <- &gripql.GraphElement{Graph: graph, Edge: e} diff --git a/cmd/load/example/main.go b/cmd/load/example/main.go index 00275243..c3a1f0d9 100644 --- a/cmd/load/example/main.go +++ b/cmd/load/example/main.go @@ -6,8 +6,8 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/gripql/example" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/load/main.go b/cmd/load/main.go index 33a4a1fd..853b2371 100644 --- a/cmd/load/main.go +++ b/cmd/load/main.go @@ -5,9 +5,9 @@ import ( "github.com/bmeg/grip/cmd/load/example" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util" "github.com/bmeg/grip/util/rpc" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -61,7 +61,7 @@ var Cmd = &cobra.Command{ wait := make(chan bool) go func() { if err := conn.BulkAdd(elemChan); err != nil { - log.Printf("bulk add error: %v", err) + log.Errorf("bulk add error: %v", err) } wait <- false }() diff --git a/cmd/mongoload/main.go b/cmd/mongoload/main.go index 257c1187..b92420bb 100644 --- a/cmd/mongoload/main.go +++ b/cmd/mongoload/main.go @@ -6,12 +6,12 @@ import ( "strings" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/mongo" "github.com/bmeg/grip/util" "github.com/bmeg/grip/util/rpc" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/rdf/main.go b/cmd/rdf/main.go index 1f0885b7..6324a0c6 100644 --- a/cmd/rdf/main.go +++ b/cmd/rdf/main.go @@ -7,10 +7,10 @@ import ( "strings" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" "github.com/golang/protobuf/jsonpb" "github.com/knakk/rdf" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/server/main.go b/cmd/server/main.go index 69669102..05c2351f 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -16,13 +16,13 @@ import ( _ "github.com/bmeg/grip/kvi/badgerdb" // import so badger will register itself _ "github.com/bmeg/grip/kvi/boltdb" // import so bolt will register itself _ "github.com/bmeg/grip/kvi/leveldb" // import so level will register itself + "github.com/bmeg/grip/log" "github.com/bmeg/grip/mongo" "github.com/bmeg/grip/psql" "github.com/bmeg/grip/server" _ "github.com/go-sql-driver/mysql" //import so mysql will register as a sql driver "github.com/imdario/mergo" _ "github.com/lib/pq" // import so postgres will register as a sql driver - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -34,7 +34,7 @@ var schemaFile string // This opens a database and starts an API server. // This blocks indefinitely. func Run(conf *config.Config, schemas map[string]*gripql.Graph) error { - config.ConfigureLogger(conf.Logger) + log.ConfigureLogger(conf.Logger) log.WithFields(log.Fields{"Config": conf}).Info("Starting Server") var db gdbi.GraphDB diff --git a/cmd/stream/main.go b/cmd/stream/main.go index 8d2c58e2..951babba 100644 --- a/cmd/stream/main.go +++ b/cmd/stream/main.go @@ -5,9 +5,9 @@ import ( "github.com/Shopify/sarama" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" "github.com/golang/protobuf/jsonpb" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/config/config.go b/config/config.go index 6d371b00..1d10f620 100644 --- a/config/config.go +++ b/config/config.go @@ -12,6 +12,7 @@ import ( "github.com/bmeg/grip/elastic" esql "github.com/bmeg/grip/existing-sql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/mongo" "github.com/bmeg/grip/psql" "github.com/bmeg/grip/server" @@ -35,7 +36,7 @@ type Config struct { MongoDB mongo.Config PSQL psql.Config ExistingSQL esql.Config - Logger Logger + Logger log.Logger } // DefaultConfig returns an instance of the default configuration for Grip. @@ -65,7 +66,7 @@ func DefaultConfig() *Config { c.Elasticsearch.DBName = "gripdb" c.Elasticsearch.BatchSize = 1000 - c.Logger = DefaultLoggerConfig() + c.Logger = log.DefaultLoggerConfig() return c } diff --git a/elastic/graph.go b/elastic/graph.go index 7d8a64de..9ed0f5e0 100644 --- a/elastic/graph.go +++ b/elastic/graph.go @@ -10,10 +10,10 @@ import ( "github.com/bmeg/grip/engine/core" "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" "github.com/bmeg/grip/util" "github.com/golang/protobuf/jsonpb" - log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" elastic "gopkg.in/olivere/elastic.v5" ) diff --git a/elastic/graphdb.go b/elastic/graphdb.go index b79ff2a0..4d3ccd22 100644 --- a/elastic/graphdb.go +++ b/elastic/graphdb.go @@ -8,8 +8,8 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" - log "github.com/sirupsen/logrus" elastic "gopkg.in/olivere/elastic.v5" ) diff --git a/elastic/index.go b/elastic/index.go index 017cb575..248fc34c 100644 --- a/elastic/index.go +++ b/elastic/index.go @@ -9,8 +9,8 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsonpath" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" - log "github.com/sirupsen/logrus" elastic "gopkg.in/olivere/elastic.v5" ) diff --git a/elastic/util.go b/elastic/util.go index 24f6cee7..dcd8f379 100644 --- a/elastic/util.go +++ b/elastic/util.go @@ -3,7 +3,7 @@ package elastic import ( "context" - log "github.com/sirupsen/logrus" + "github.com/bmeg/grip/log" elastic "gopkg.in/olivere/elastic.v5" ) diff --git a/engine/core/processors.go b/engine/core/processors.go index b8fb58b5..fb2d6f6c 100644 --- a/engine/core/processors.go +++ b/engine/core/processors.go @@ -13,9 +13,9 @@ import ( "github.com/bmeg/grip/jsonpath" "github.com/bmeg/grip/kvi" "github.com/bmeg/grip/kvindex" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" structpb "github.com/golang/protobuf/ptypes/struct" - log "github.com/sirupsen/logrus" "github.com/spenczar/tdigest" "github.com/spf13/cast" "golang.org/x/sync/errgroup" diff --git a/engine/pipes.go b/engine/pipes.go index fb398c43..309be667 100644 --- a/engine/pipes.go +++ b/engine/pipes.go @@ -9,8 +9,8 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" - log "github.com/sirupsen/logrus" ) // Start begins processing a query pipeline diff --git a/existing-sql/graph.go b/existing-sql/graph.go index 799a9d54..7532ec44 100644 --- a/existing-sql/graph.go +++ b/existing-sql/graph.go @@ -9,9 +9,9 @@ import ( "github.com/bmeg/grip/engine/core" "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" "github.com/jmoiron/sqlx" - log "github.com/sirupsen/logrus" ) // Graph is the interface to a single graph @@ -194,7 +194,7 @@ func (g *Graph) VertexLabelScan(ctx context.Context, label string) chan string { data := make(map[string]interface{}) if err := rows.MapScan(data); err != nil { log.WithFields(log.Fields{"error": err}).Error("VertexLabelScan: MapScan") - log.Println("VertexLabelScan failed:", err) + log.Errorln("VertexLabelScan failed:", err) return } v := rowDataToVertex(v, data, types, false) diff --git a/go.sum b/go.sum index 98506778..c94173ac 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798 h1:2T/jmrHeTezcCM58lvEQXs0UpQJCo5SoGAcg+mbSTIg= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/OpenPeeDeeP/depguard v0.0.0-20180806142446-a69c782687b2 h1:HTOmFEEYrWi4MW5ZKUx6xfeyM10Sx3kQF65xiQJMPYA= github.com/OpenPeeDeeP/depguard v0.0.0-20180806142446-a69c782687b2/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o= github.com/Shopify/sarama v1.22.1 h1:exyEsKLGyCsDiqpV5Lr4slFi8ev2KiM3cP1KZ6vnCQ0= github.com/Shopify/sarama v1.22.1/go.mod h1:FRzlvRpMFO/639zY1SDxUxkqH97Y0ndM5CbGj6oG3As= @@ -55,14 +57,18 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 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-critic/go-critic v0.0.0-20181204210945-ee9bf5809ead h1:qwmAYufKDopQnFdeMw+iHJVxAd2CbF+VFKHyJJwnPKk= github.com/go-critic/go-critic v0.0.0-20181204210945-ee9bf5809ead/go.mod h1:3MzXZKJdeXqdU9cj+rvZdNiN7SZ8V9OjybF8loZDmHU= +github.com/go-lintpack/lintpack v0.5.2 h1:DI5mA3+eKdWeJ40nU4d6Wc26qmdG8RCi/btYq0TuRN0= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-sourcemap/sourcemap v2.1.2+incompatible h1:0b/xya7BKGhXuqFESKM4oIiRo9WOt2ebz7KxfreD6ug= @@ -70,20 +76,30 @@ github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-toolsmith/astcast v0.0.0-20181028201508-b7a89ed70af1 h1:h+1eMw+tZAlgTVclcVN0/rdPaBI/RUzG0peblT6df+Q= github.com/go-toolsmith/astcast v0.0.0-20181028201508-b7a89ed70af1/go.mod h1:TEo3Ghaj7PsZawQHxT/oBvo4HK/sl1RcuUHDKTTju+o= +github.com/go-toolsmith/astcopy v0.0.0-20180903214859-79b422d080c4 h1:wVs9OMjICHbAryp9hcIuWqUOi+NqEbUSZy9zMe3W//I= github.com/go-toolsmith/astcopy v0.0.0-20180903214859-79b422d080c4/go.mod h1:c9CPdq2AzM8oPomdlPniEfPAC6g1s7NqZzODt8y6ib8= +github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6 h1:aTBUNRTatDDU24gbOEKEoLiDwxtc98ga6K/iMTm6fvs= github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086 h1:EIMuvbE9fbtQtimdLe5yeXjuC5CeKbQt8zH6GwtIrhM= github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= +github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30 h1:zRJPftZJNLPDiOtvYbFRwjSbaJAcVOf80TeEmWGe2kQ= github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= +github.com/go-toolsmith/strparse v0.0.0-20180903215201-830b6daa1241 h1:ZRDeQioMGTBLeJxcPxXfFifEUgYxzR7fXw7w2WR+1bo= github.com/go-toolsmith/strparse v0.0.0-20180903215201-830b6daa1241/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v0.0.0-20181030061450-d63dc7650676 h1:6Qrsp0+25KEkaS2bB26UE0giFgRrIc8mYXboDL5OVMA= github.com/go-toolsmith/typep v0.0.0-20181030061450-d63dc7650676/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/goburrow/cache v0.1.0/go.mod h1:8oxkfud4hvjO4tNjEKZfEd+LrpDVDlBIauGYsWGEzio= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= @@ -93,22 +109,39 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 h1:i2jIkQFb8RG45DuQs+ElyROY848cSJIoIkBM+7XXypA= github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= +github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 h1:9rtVlONXLF1rJZzvLt4tfOXtnAFUEhxCJ64Ibzj6ECo= github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196/go.mod h1:unzUULGw35sjyOYjUt0jMTXqHlZPpPc6e+xfO4cd6mM= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 h1:pe9JHs3cHHDQgOFXJJdYkK6fLz2PWyYtP4hthoCMvs8= github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= +github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee h1:J2XAy40+7yz70uaOiMbNnluTg7gyQhtGqLQncQh+4J8= github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= +github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 h1:ir6/L2ZOJfFrJlOTsuf/hlzdPuUwXV/VzkSlgS6f1vs= github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= +github.com/golangci/golangci-lint v1.16.0 h1:PcWAN9JHflZzJQaZVY1JXZE0Tgjq+jO2v4QLqJ/Azvw= github.com/golangci/golangci-lint v1.16.0/go.mod h1:uySrAxrUmZYnxyccYSnwuAEm+3144Zg5IAUueIW8+fA= +github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 h1:qMomh8bv+kDazm1dSLZ9S3zZ2PJZMHL4ilfBjxFOlmI= github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547/go.mod h1:0qUabqiIQgfmlAmulqxyiGkkyF6/tOGSnY2cnPVwrzU= +github.com/golangci/ineffassign v0.0.0-20180808204949-2ee8f2867dde h1:qEGp3ZF1Qw6TkbWKn6GdJ12Ssu/CpJBaBcJ4hrUjrSo= github.com/golangci/ineffassign v0.0.0-20180808204949-2ee8f2867dde/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= +github.com/golangci/lint-1 v0.0.0-20180610141402-4bf9709227d1 h1:PHK2kIh21Zt4IcG0bBRzQwEDVKF64LnkoSXnm8lfJUk= github.com/golangci/lint-1 v0.0.0-20180610141402-4bf9709227d1/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 h1:EL/O5HGrF7Jaq0yNhBLucz9hTuRzj2LdwGBOaENgxIk= github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSSx3J/s5sVf4Drkc68W2wm4Ixh/mr0us= github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg= github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/graphql-go/graphql v0.7.8 h1:769CR/2JNAhLG9+aa8pfLkKdR0H+r5lsQqling5WwpU= @@ -126,17 +159,21 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/kisielk/gotool v0.0.0-20161130080628-0de1eaf82fa3/go.mod h1:jxZFDH7ILpTPQTk+E2s+z4CUas9lVNjIuKR4c5/zKgM= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/knakk/rdf v0.0.0-20190304171630-8521bf4c5042 h1:Vzdm5hdlLdpJOKK+hKtkV5u7xGZmNW6aUBjGcTfwx84= github.com/knakk/rdf v0.0.0-20190304171630-8521bf4c5042/go.mod h1:fYE0718xXI13XMYLc6iHtvXudfyCGMsZ9hxSM1Ommpg= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -150,20 +187,26 @@ github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQ github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946 h1:z+WaKrgu3kCpcdnbK9YG+JThpOCd1nU5jO5ToVmSlR4= github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5 h1:0x4qcEHDpruK6ML/m/YSlFUUu0UpRD3I2PHsNCuGnyA= github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mozilla/tls-observatory v0.0.0-20180409132520-8791a200eb40/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/nbutton23/zxcvbn-go v0.0.0-20160627004424-a22cb81b2ecd/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663 h1:Ri1EhipkbhWsffPJ3IPlrb4SkTOPa2PfRXp3jchBczw= github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4= @@ -176,6 +219,7 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/paulbellamy/ratecounter v0.2.0 h1:2L/RhJq+HA8gBQImDXtLPrDXK5qAj6ozWVK/zFXVJGs= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41 h1:GeinFsrjWz97fAxVUEd748aV0cYL+I6k44gFJTCVvpU= github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= @@ -184,6 +228,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +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/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -208,6 +253,7 @@ github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIa github.com/spenczar/tdigest v2.1.0+incompatible h1:fW2Amo+VWvKXzANU0TyeOGi3xS0jDcM8y5gC5CHhSHM= github.com/spenczar/tdigest v2.1.0+incompatible/go.mod h1:taEJf1IAhnY3KPrPBSUP4dNFwy4XSWs83kbY/FzdtSU= github.com/spf13/afero v1.1.0/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= @@ -218,15 +264,18 @@ github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3 github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= +github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= 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.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= @@ -315,8 +364,13 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= +mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34 h1:B1LAOfRqg2QUyCdzfjf46quTSYUTAK5OCwbh6pljHbM= mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34/go.mod h1:H6SUd1XjIs+qQCyskXg5OFSrilMRUkD8ePJpHKDPaeY= +sourcegraph.com/sourcegraph/go-diff v0.5.1-0.20190210232911-dee78e514455 h1:qoQ5Kt+Zm+GXBtz49YwD3juBhr/E0U25jO6bBzxW6NI= sourcegraph.com/sourcegraph/go-diff v0.5.1-0.20190210232911-dee78e514455/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/graphql/handler.go b/graphql/handler.go index 2c65ed9c..0880d68a 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -10,10 +10,10 @@ import ( "regexp" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" "github.com/graphql-go/graphql" "github.com/graphql-go/handler" - log "github.com/sirupsen/logrus" ) //handle the graphql queries for a single endpoint diff --git a/gripql/client.go b/gripql/client.go index c7e97372..769b3202 100644 --- a/gripql/client.go +++ b/gripql/client.go @@ -4,8 +4,8 @@ import ( "context" "io" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" - log "github.com/sirupsen/logrus" "google.golang.org/grpc" ) diff --git a/jsengine/v8/v8.go b/jsengine/v8/v8.go index cd243272..094b915f 100644 --- a/jsengine/v8/v8.go +++ b/jsengine/v8/v8.go @@ -10,8 +10,8 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsengine" "github.com/bmeg/grip/jsengine/underscore" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" - log "github.com/sirupsen/logrus" ) type V8Runtime struct { diff --git a/jsonpath/jsonpath.go b/jsonpath/jsonpath.go index fc07037f..01644249 100644 --- a/jsonpath/jsonpath.go +++ b/jsonpath/jsonpath.go @@ -6,8 +6,8 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/oliveagle/jsonpath" - log "github.com/sirupsen/logrus" ) // Current represents the 'current' traveler namespace diff --git a/kvgraph/graph.go b/kvgraph/graph.go index db52f866..c2dd6dd7 100644 --- a/kvgraph/graph.go +++ b/kvgraph/graph.go @@ -10,9 +10,9 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/kvi" "github.com/bmeg/grip/kvindex" + "github.com/bmeg/grip/log" proto "github.com/golang/protobuf/proto" "github.com/hashicorp/go-multierror" - log "github.com/sirupsen/logrus" ) func contains(a []string, v string) bool { diff --git a/kvgraph/index.go b/kvgraph/index.go index f2c06d18..2ba10416 100644 --- a/kvgraph/index.go +++ b/kvgraph/index.go @@ -8,9 +8,9 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsonpath" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" structpb "github.com/golang/protobuf/ptypes/struct" - log "github.com/sirupsen/logrus" "github.com/spenczar/tdigest" ) diff --git a/kvgraph/schema.go b/kvgraph/schema.go index 9b79db49..2ee68b7d 100644 --- a/kvgraph/schema.go +++ b/kvgraph/schema.go @@ -6,9 +6,9 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/bmeg/grip/util" - log "github.com/sirupsen/logrus" ) // BuildSchema returns the schema of a specific graph in the database diff --git a/kvi/badgerdb/badger_store.go b/kvi/badgerdb/badger_store.go index 7e675ad5..7fc192a2 100644 --- a/kvi/badgerdb/badger_store.go +++ b/kvi/badgerdb/badger_store.go @@ -11,8 +11,8 @@ import ( "github.com/bmeg/grip/kvgraph" "github.com/bmeg/grip/kvi" + "github.com/bmeg/grip/log" "github.com/dgraph-io/badger" - log "github.com/sirupsen/logrus" ) var loaded = kvgraph.AddKVDriver("badger", NewKVInterface) @@ -28,8 +28,10 @@ func NewKVInterface(path string, kopts kvi.Options) (kvi.KVInterface, error) { } } + logger := log.GetLogger() + sublogger := logger.WithFields(log.Fields{"namespace": "badger"}) opts := badger.DefaultOptions(path) - opts = opts.WithLogger(log.New()) + opts = opts.WithLogger(sublogger) db, err := badger.Open(opts) if err != nil { return nil, err diff --git a/kvi/boltdb/bolt_store.go b/kvi/boltdb/bolt_store.go index 12b9fc14..fa3ff7c6 100644 --- a/kvi/boltdb/bolt_store.go +++ b/kvi/boltdb/bolt_store.go @@ -10,8 +10,8 @@ import ( "github.com/bmeg/grip/kvgraph" "github.com/bmeg/grip/kvi" + "github.com/bmeg/grip/log" "github.com/boltdb/bolt" - log "github.com/sirupsen/logrus" ) var loaded = kvgraph.AddKVDriver("bolt", NewKVInterface) diff --git a/kvi/leveldb/level_store.go b/kvi/leveldb/level_store.go index 719c0468..f920c483 100644 --- a/kvi/leveldb/level_store.go +++ b/kvi/leveldb/level_store.go @@ -10,7 +10,7 @@ import ( "github.com/bmeg/grip/kvgraph" "github.com/bmeg/grip/kvi" - log "github.com/sirupsen/logrus" + "github.com/bmeg/grip/log" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/iterator" "github.com/syndtr/goleveldb/leveldb/opt" diff --git a/kvindex/kvindex.go b/kvindex/kvindex.go index b0c03492..cdba11f4 100644 --- a/kvindex/kvindex.go +++ b/kvindex/kvindex.go @@ -9,8 +9,8 @@ import ( "strings" "github.com/bmeg/grip/kvi" + "github.com/bmeg/grip/log" proto "github.com/golang/protobuf/proto" - log "github.com/sirupsen/logrus" ) // TermType defines in a term is a Number or a String @@ -344,7 +344,7 @@ func (idx *KVIndex) termGetCount(tx kvi.KVTransaction, field string, ttype TermT binary.PutUvarint(buf, count) err = tx.Set(termKey, buf) if err != nil { - log.Printf("Change count error: %s", err) + log.Errorf("Change count error: %s", err) return 0, err } } diff --git a/config/logger.go b/log/logger.go similarity index 57% rename from config/logger.go rename to log/logger.go index db5b321c..f147a8d3 100644 --- a/config/logger.go +++ b/log/logger.go @@ -1,4 +1,4 @@ -package config +package log import ( "bytes" @@ -15,10 +15,12 @@ import ( "github.com/golang/protobuf/proto" "github.com/kr/pretty" "github.com/logrusorgru/aurora" - log "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh/terminal" ) +var logger = logrus.New() + const defaultTimestampFormat = time.RFC3339 // Logger provides configuration for a logger. @@ -72,12 +74,12 @@ func DefaultLoggerConfig() Logger { type jsonFormatter struct { conf JSONFormatConfig - fmt *log.JSONFormatter + fmt *logrus.JSONFormatter } -func (f *jsonFormatter) Format(entry *log.Entry) ([]byte, error) { +func (f *jsonFormatter) Format(entry *logrus.Entry) ([]byte, error) { if f.fmt == nil { - f.fmt = &log.JSONFormatter{ + f.fmt = &logrus.JSONFormatter{ DisableTimestamp: f.conf.DisableTimestamp, TimestampFormat: f.conf.TimestampFormat, } @@ -107,7 +109,7 @@ func isColorTerminal(w io.Writer) bool { return checkIfTerminal(w) && (runtime.GOOS != "windows") } -func (f *textFormatter) Format(entry *log.Entry) ([]byte, error) { +func (f *textFormatter) Format(entry *logrus.Entry) ([]byte, error) { isColored := (f.ForceColors || isColorTerminal(entry.Logger.Out)) && !f.DisableColors if !isColored { return f.json.Format(entry) @@ -125,11 +127,11 @@ func (f *textFormatter) Format(entry *log.Entry) ([]byte, error) { var levelColor aurora.Color switch entry.Level { - case log.DebugLevel: + case logrus.DebugLevel: levelColor = aurora.MagentaFg - case log.WarnLevel: + case logrus.WarnLevel: levelColor = aurora.BrownFg - case log.ErrorLevel, log.FatalLevel, log.PanicLevel: + case logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel: levelColor = aurora.RedFg default: levelColor = aurora.CyanFg @@ -183,7 +185,7 @@ func (f *textFormatter) Format(entry *log.Entry) ([]byte, error) { return b.Bytes(), nil } -func (f *textFormatter) sortKeys(entry *log.Entry) []string { +func (f *textFormatter) sortKeys(entry *logrus.Entry) []string { // Gather keys so they can be sorted keys := make([]string, 0, len(entry.Data)) @@ -200,34 +202,47 @@ func (f *textFormatter) sortKeys(entry *log.Entry) []string { return keys } -// ConfigureLogger configures the global logrus logger +// ConfigureLogger configures the global and local logrus logger func ConfigureLogger(conf Logger) { switch strings.ToLower(conf.Level) { case "debug": - log.SetLevel(log.DebugLevel) + logrus.SetLevel(logrus.DebugLevel) + logger.SetLevel(logrus.DebugLevel) case "info": - log.SetLevel(log.InfoLevel) + logrus.SetLevel(logrus.InfoLevel) + logger.SetLevel(logrus.InfoLevel) case "warn", "warning": - log.SetLevel(log.WarnLevel) + logrus.SetLevel(logrus.WarnLevel) + logger.SetLevel(logrus.WarnLevel) case "error": - log.SetLevel(log.ErrorLevel) + logrus.SetLevel(logrus.ErrorLevel) default: - log.Warningf("Unknown log level: '%s'; defaulting to 'info'", conf.Level) - log.SetLevel(log.InfoLevel) + logrus.Warningf("Unknown log level: '%s'; defaulting to 'info'", conf.Level) + logrus.SetLevel(logrus.InfoLevel) + logger.SetLevel(logrus.InfoLevel) } switch strings.ToLower(conf.Formatter) { case "json": - log.SetFormatter(&jsonFormatter{ + logrus.SetFormatter(&jsonFormatter{ + conf: conf.JSONFormat, + }) + logger.SetFormatter(&jsonFormatter{ conf: conf.JSONFormat, }) // Default to text default: if strings.ToLower(conf.Formatter) != "text" { - log.Warningf("Unknown log formatter: '%s'; defaulting to 'text'", conf.Formatter) + logrus.Warningf("Unknown log formatter: '%s'; defaulting to 'text'", conf.Formatter) } - log.SetFormatter(&textFormatter{ + logrus.SetFormatter(&textFormatter{ + conf.TextFormat, + jsonFormatter{ + conf: conf.JSONFormat, + }, + }) + logger.SetFormatter(&textFormatter{ conf.TextFormat, jsonFormatter{ conf: conf.JSONFormat, @@ -240,9 +255,101 @@ func ConfigureLogger(conf Logger) { conf.OutputFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666, ) if err != nil { - log.Errorf("Can't open log output file: %s", conf.OutputFile) + logrus.Errorf("Can't open log output file: %s", conf.OutputFile) } else { - log.SetOutput(logFile) + logrus.SetOutput(logFile) + logger.SetOutput(logFile) } } } + +// Debug log message +func Debug(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Debugln log message +func Debugln(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Debugf log message +func Debugf(format string, args ...interface{}) { + logger.Debug(fmt.Sprintf(format, args...)) +} + +// Info log message +func Info(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Infoln log message +func Infoln(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Infof log message +func Infof(format string, args ...interface{}) { + logger.Debug(fmt.Sprintf(format, args...)) +} + +// Warning log message +func Warning(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Warningln log message +func Warningln(args ...interface{}) { + logger.Debug(fmt.Sprint(args...)) +} + +// Warningf log message +func Warningf(format string, args ...interface{}) { + logger.Debug(fmt.Sprintf(format, args...)) +} + +// Error log message +func Error(args ...interface{}) { + logger.Error(fmt.Sprint(args...)) +} + +// Errorln log message +func Errorln(args ...interface{}) { + logger.Error(fmt.Sprint(args...)) +} + +// Errorf log message +func Errorf(format string, args ...interface{}) { + logger.Error(fmt.Sprintf(format, args...)) +} + +// Fatal log message +func Fatal(args ...interface{}) { + logger.Error(fmt.Sprint(args...)) + os.Exit(1) +} + +// Fatalln log message +func Fatalln(args ...interface{}) { + logger.Error(fmt.Sprint(args...)) + os.Exit(1) +} + +// Fatalf log message +func Fatalf(format string, args ...interface{}) { + logger.Error(fmt.Sprintf(format, args...)) + os.Exit(1) +} + +// Fields type, used to pass to `WithFields`. +type Fields = logrus.Fields + +// WithFields creates an entry from the standard logger and adds multiple fields to it. +func WithFields(fields Fields) *logrus.Entry { + return logger.WithFields(fields) +} + +// GetLogger returns the configured logger +func GetLogger() *logrus.Logger { + return logger +} diff --git a/main.go b/main.go index b2418465..df320e84 100644 --- a/main.go +++ b/main.go @@ -5,11 +5,11 @@ import ( "os" "github.com/bmeg/grip/cmd" - "github.com/bmeg/grip/config" + "github.com/bmeg/grip/log" ) func main() { - config.ConfigureLogger(config.DefaultLoggerConfig()) + log.ConfigureLogger(log.DefaultLoggerConfig()) if err := cmd.RootCmd.Execute(); err != nil { fmt.Println("Error:", err.Error()) os.Exit(1) diff --git a/mongo/compile.go b/mongo/compile.go index 67cc595d..d8b73ea3 100644 --- a/mongo/compile.go +++ b/mongo/compile.go @@ -8,9 +8,9 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsonpath" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" ) // Pipeline a set of runnable query operations diff --git a/mongo/graph.go b/mongo/graph.go index fa0c9f9d..67dec19b 100644 --- a/mongo/graph.go +++ b/mongo/graph.go @@ -9,11 +9,11 @@ import ( "github.com/bmeg/grip/engine/core" "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" "github.com/bmeg/grip/util" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" ) // Graph is the interface to a single graph diff --git a/mongo/graphdb.go b/mongo/graphdb.go index 75ab6227..c6e3c7b9 100644 --- a/mongo/graphdb.go +++ b/mongo/graphdb.go @@ -7,10 +7,10 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" ) // Config describes the configuration for the mongodb driver. diff --git a/mongo/has_evaluator.go b/mongo/has_evaluator.go index a8dfa7d2..4027d7b1 100644 --- a/mongo/has_evaluator.go +++ b/mongo/has_evaluator.go @@ -5,9 +5,9 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsonpath" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" ) func convertHasExpression(stmt *gripql.HasExpression, not bool) bson.M { diff --git a/mongo/index.go b/mongo/index.go index 6e756c9e..e82fcbb3 100644 --- a/mongo/index.go +++ b/mongo/index.go @@ -8,10 +8,10 @@ import ( "github.com/bmeg/grip/gripql" "github.com/bmeg/grip/jsonpath" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" ) // AddVertexIndex add index to vertices @@ -288,7 +288,7 @@ func (mg *Graph) VertexLabelScan(ctx context.Context, label string) chan string } } if err := iter.Close(); err != nil { - log.Println("VertexLabelScan error:", err) + log.Errorln("VertexLabelScan error:", err) } }() diff --git a/mongo/processor.go b/mongo/processor.go index 224d1ce5..9721e5a2 100644 --- a/mongo/processor.go +++ b/mongo/processor.go @@ -7,11 +7,11 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/bmeg/grip/util" "github.com/globalsign/mgo/bson" structpb "github.com/golang/protobuf/ptypes/struct" - log "github.com/sirupsen/logrus" ) // Processor stores the information for a mongo aggregation pipeline diff --git a/mongo/schema.go b/mongo/schema.go index 07d2c144..e6996d8a 100644 --- a/mongo/schema.go +++ b/mongo/schema.go @@ -6,10 +6,10 @@ import ( "time" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/bmeg/grip/util" "github.com/globalsign/mgo/bson" - log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" ) diff --git a/protoutil/protoutil.go b/protoutil/protoutil.go index 05faf996..4afb2266 100644 --- a/protoutil/protoutil.go +++ b/protoutil/protoutil.go @@ -6,9 +6,9 @@ import ( "reflect" "time" + "github.com/bmeg/grip/log" "github.com/golang/protobuf/jsonpb" structpb "github.com/golang/protobuf/ptypes/struct" - log "github.com/sirupsen/logrus" ) //StructSet take value and add it to Struct s using key diff --git a/psql/graph.go b/psql/graph.go index 9239ecc8..100fa0a0 100644 --- a/psql/graph.go +++ b/psql/graph.go @@ -8,11 +8,11 @@ import ( "github.com/bmeg/grip/engine/core" "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/protoutil" "github.com/bmeg/grip/timestamp" "github.com/bmeg/grip/util" "github.com/jmoiron/sqlx" - log "github.com/sirupsen/logrus" ) const batchSize int = 1000 diff --git a/psql/graphdb.go b/psql/graphdb.go index 249ac523..c64c4670 100644 --- a/psql/graphdb.go +++ b/psql/graphdb.go @@ -6,9 +6,9 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/timestamp" "github.com/jmoiron/sqlx" - log "github.com/sirupsen/logrus" ) // Config describes the configuration for the sql driver. diff --git a/server/api.go b/server/api.go index 8325e0b3..59b45beb 100644 --- a/server/api.go +++ b/server/api.go @@ -10,8 +10,8 @@ import ( "github.com/bmeg/grip/engine" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util" - log "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/server/server.go b/server/server.go index 5957dda8..8d244d5f 100644 --- a/server/server.go +++ b/server/server.go @@ -12,10 +12,10 @@ import ( "github.com/bmeg/grip/gdbi" "github.com/bmeg/grip/graphql" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/bmeg/grip/util/rpc" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/grpc-gateway/runtime" - log "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -294,7 +294,7 @@ func (server *GripServer) Serve(pctx context.Context) error { if server.db != nil { err = server.db.Close() if err != nil { - log.Println("error:", err) + log.Errorln("db.Close() error:", err) } } log.Infoln("shutting down RPC server...") diff --git a/util/file_reader.go b/util/file_reader.go index c1753cbd..d814b629 100644 --- a/util/file_reader.go +++ b/util/file_reader.go @@ -9,8 +9,8 @@ import ( "github.com/bmeg/golib" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/golang/protobuf/jsonpb" - log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" ) diff --git a/util/insert.go b/util/insert.go index 6554fc90..af8e2e81 100644 --- a/util/insert.go +++ b/util/insert.go @@ -5,8 +5,8 @@ import ( "sync" "github.com/bmeg/grip/gripql" + "github.com/bmeg/grip/log" "github.com/hashicorp/go-multierror" - log "github.com/sirupsen/logrus" ) // StreamBatch a stream of inputs and loads them into the graph