From e8be96a4e706fd82f253115d9d164e690480ec09 Mon Sep 17 00:00:00 2001 From: Taka Goto Date: Tue, 20 Nov 2018 22:47:01 -0600 Subject: [PATCH] use logrus for logging --- .gitignore | 1 + Gopkg.toml | 4 ++++ README.md | 1 + cmd/backfillMakerLogs.go | 3 +-- cmd/coldImport.go | 3 +-- cmd/continuousLogSync.go | 2 +- cmd/erc20.go | 2 +- cmd/getSignatures.go | 2 +- cmd/lightSync.go | 2 +- cmd/root.go | 9 ++++----- cmd/sync.go | 2 +- environments/local.toml.example | 19 ------------------- .../every_block/every_block_suite_test.go | 2 +- examples/erc20_watcher/every_block/fetcher.go | 4 ++-- .../erc20_watcher/every_block/repository.go | 2 +- .../erc20_watcher/every_block/transformer.go | 3 ++- main.go | 10 ++++++++++ pkg/datastore/postgres/postgres_suite_test.go | 2 +- .../postgres/repositories/block_repository.go | 2 +- pkg/geth/testing/helpers.go | 2 +- pkg/history/history_suite_test.go | 2 +- pkg/history/populate_headers.go | 3 +-- pkg/transformers/bite/bite_suite_test.go | 2 +- .../chop_lump/chop_lump_suite_test.go | 2 +- .../cat_file/flip/flip_suite_test.go | 2 +- .../cat_file/pit_vow/pit_vow_suite_test.go | 2 +- pkg/transformers/deal/deal_suite_test.go | 2 +- pkg/transformers/dent/dent_suite_test.go | 2 +- .../drip_drip/drip_drip_suite_test.go | 2 +- .../drip_file/ilk/ilk_suite_test.go | 2 +- .../drip_file/repo/repo_suite_test.go | 2 +- .../drip_file/vow/vow_suite_test.go | 2 +- .../factories/factories_suite_test.go | 2 +- .../factories/log_note_transformer.go | 6 +++--- pkg/transformers/factories/transformer.go | 2 +- .../flap_kick/flap_kick_suite_test.go | 2 +- .../flip_kick/flip_kick_suite_test.go | 2 +- pkg/transformers/frob/converter.go | 2 ++ pkg/transformers/frob/frob_suite_test.go | 2 +- .../integration_tests_suite_test.go | 2 +- .../integration_tests/vow_flog.go | 8 ++++---- .../debt_ceiling/debt_ceiling_suite_test.go | 2 +- .../pit_file/ilk/ilk_suite_test.go | 2 +- .../price_feeds/price_feeds_suite_test.go | 2 +- pkg/transformers/tend/tend_suite_test.go | 2 +- .../vat_flux/vat_flux_suite_test.go | 2 +- .../vat_fold/vat_fold_suite_test.go | 2 +- .../vat_grab/vat_grab_suite_test.go | 2 +- .../vat_heal/vat_heal_suite_test.go | 2 +- .../vat_init/vat_init_suite_test.go | 2 +- .../vat_move/vat_move_suite_test.go | 2 +- .../vat_slip/vat_slip_suite_test.go | 2 +- .../vat_toll/vat_toll_suite_test.go | 2 +- .../vat_tune/vat_tune_suite_test.go | 2 +- .../vow_flog/vow_flog_suite_test.go | 2 +- test_config/test_config.go | 2 +- utils/utils.go | 2 +- 57 files changed, 79 insertions(+), 83 deletions(-) delete mode 100644 environments/local.toml.example diff --git a/.gitignore b/.gitignore index 51e98413..edac9c99 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ vulcanizedb postgraphile/build/ postgraphile/node_modules/ postgraphile/package-lock.json +vulcanizedb.log diff --git a/Gopkg.toml b/Gopkg.toml index 64fa278b..1636b6c5 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -41,6 +41,10 @@ branch = "master" name = "github.com/lib/pq" +[[constraint]] + name = "gopkg.in/Sirupsen/logrus.v1" + version = "1.2.0" + [[constraint]] name = "github.com/spf13/cobra" version = "0.0.1" diff --git a/README.md b/README.md index 3ec25c9e..43b0d7b6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Vulcanize DB is a set of tools that make it easier for developers to write appli ## Installation `go get github.com/vulcanize/vulcanizedb` `go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace` +`go get gopkg.in/Sirupsen/logrus.v1` ## Setting up the Database 1. Install Postgres diff --git a/cmd/backfillMakerLogs.go b/cmd/backfillMakerLogs.go index dbf61a22..07a3d003 100644 --- a/cmd/backfillMakerLogs.go +++ b/cmd/backfillMakerLogs.go @@ -15,8 +15,7 @@ package cmd import ( - "log" - + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/libraries/shared" diff --git a/cmd/coldImport.go b/cmd/coldImport.go index d7265cb5..f9045f06 100644 --- a/cmd/coldImport.go +++ b/cmd/coldImport.go @@ -15,8 +15,7 @@ package cmd import ( - "log" - + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/pkg/crypto" diff --git a/cmd/continuousLogSync.go b/cmd/continuousLogSync.go index 9589a8d8..9c23af1b 100644 --- a/cmd/continuousLogSync.go +++ b/cmd/continuousLogSync.go @@ -16,9 +16,9 @@ package cmd import ( "fmt" - "log" "time" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/libraries/shared" diff --git a/cmd/erc20.go b/cmd/erc20.go index f6e46e36..d0d8f112 100644 --- a/cmd/erc20.go +++ b/cmd/erc20.go @@ -15,9 +15,9 @@ package cmd import ( - "log" "time" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/examples/erc20_watcher/every_block" diff --git a/cmd/getSignatures.go b/cmd/getSignatures.go index 64c43d97..872d3fd5 100644 --- a/cmd/getSignatures.go +++ b/cmd/getSignatures.go @@ -15,9 +15,9 @@ package cmd import ( + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "log" ) // getSignaturesCmd represents the getSignatures command diff --git a/cmd/lightSync.go b/cmd/lightSync.go index 4ea79765..76f2976e 100644 --- a/cmd/lightSync.go +++ b/cmd/lightSync.go @@ -15,10 +15,10 @@ package cmd import ( - "log" "os" "time" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/pkg/core" diff --git a/cmd/root.go b/cmd/root.go index 500c8be6..ad425540 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,13 +15,12 @@ package cmd import ( - "fmt" - "log" "os" "time" "github.com/ethereum/go-ethereum/rpc" "github.com/mitchellh/go-homedir" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -55,7 +54,7 @@ var rootCmd = &cobra.Command{ func Execute() { if err := rootCmd.Execute(); err != nil { - fmt.Println(err) + log.Fatal(err) os.Exit(1) } } @@ -102,7 +101,7 @@ func initConfig() { } else { home, err := homedir.Dir() if err != nil { - fmt.Println(err) + log.Fatal(err) os.Exit(1) } @@ -113,7 +112,7 @@ func initConfig() { viper.AutomaticEnv() if err := viper.ReadInConfig(); err == nil { - fmt.Printf("Using config file: %s\n\n", viper.ConfigFileUsed()) + log.Printf("Using config file: %s\n\n", viper.ConfigFileUsed()) } } diff --git a/cmd/sync.go b/cmd/sync.go index 77824a6c..bbf51a9c 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -15,10 +15,10 @@ package cmd import ( - "log" "os" "time" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vulcanize/vulcanizedb/pkg/core" diff --git a/environments/local.toml.example b/environments/local.toml.example deleted file mode 100644 index 9a10ff99..00000000 --- a/environments/local.toml.example +++ /dev/null @@ -1,19 +0,0 @@ -[database] -name = "vulcanize_public" -hostname = "localhost" -port = 5432 - -[client] -ipcPath = "http://127.0.0.1:7545" - -[contract] -cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" -drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" -eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" -mcd_flap = "0x8868BAd8e74FcA4505676D1B5B21EcC23328d132" -mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" -pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" -pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" -pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" -rep = "0xf88bBDc1E2718F8857F30A180076ec38d53cf296" -vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" \ No newline at end of file diff --git a/examples/erc20_watcher/every_block/every_block_suite_test.go b/examples/erc20_watcher/every_block/every_block_suite_test.go index 61cb9c87..69d12677 100644 --- a/examples/erc20_watcher/every_block/every_block_suite_test.go +++ b/examples/erc20_watcher/every_block/every_block_suite_test.go @@ -19,8 +19,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestEveryBlock(t *testing.T) { diff --git a/examples/erc20_watcher/every_block/fetcher.go b/examples/erc20_watcher/every_block/fetcher.go index e644b0c5..07681fe4 100644 --- a/examples/erc20_watcher/every_block/fetcher.go +++ b/examples/erc20_watcher/every_block/fetcher.go @@ -16,7 +16,7 @@ package every_block import ( "fmt" - "log" + log "github.com/sirupsen/logrus" "math/big" "github.com/vulcanize/vulcanizedb/pkg/core" @@ -50,7 +50,7 @@ func (fe *fetcherError) Error() string { func newFetcherError(err error, fetchMethod string) *fetcherError { e := fetcherError{err.Error(), fetchMethod} - log.Println(e.Error()) + log.Info(e.Error()) return &e } diff --git a/examples/erc20_watcher/every_block/repository.go b/examples/erc20_watcher/every_block/repository.go index c0c4d79c..c641665b 100644 --- a/examples/erc20_watcher/every_block/repository.go +++ b/examples/erc20_watcher/every_block/repository.go @@ -16,8 +16,8 @@ package every_block import ( "fmt" + log "github.com/sirupsen/logrus" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "log" ) type ERC20RepositoryInterface interface { diff --git a/examples/erc20_watcher/every_block/transformer.go b/examples/erc20_watcher/every_block/transformer.go index 13246171..81ff4370 100644 --- a/examples/erc20_watcher/every_block/transformer.go +++ b/examples/erc20_watcher/every_block/transformer.go @@ -16,9 +16,10 @@ package every_block import ( "fmt" - "log" "math/big" + log "github.com/sirupsen/logrus" + "github.com/vulcanize/vulcanizedb/examples/erc20_watcher" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" diff --git a/main.go b/main.go index 4ff854f7..27f46ea1 100644 --- a/main.go +++ b/main.go @@ -3,11 +3,21 @@ package main import ( "github.com/vulcanize/vulcanizedb/cmd" + log "github.com/sirupsen/logrus" "github.com/spf13/viper" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "os" ) func main() { + log.SetFormatter(&log.JSONFormatter{}) + file, err := os.OpenFile("vulcanizedb.log", os.O_CREATE|os.O_WRONLY, 0666) + if err == nil { + log.SetOutput(file) + } else { + log.Info("Failed to log to file, using default stderr") + } + tracer.Start(tracer.WithServiceName(viper.GetString("datadog.name"))) cmd.Execute() diff --git a/pkg/datastore/postgres/postgres_suite_test.go b/pkg/datastore/postgres/postgres_suite_test.go index d2b9876e..34814fba 100644 --- a/pkg/datastore/postgres/postgres_suite_test.go +++ b/pkg/datastore/postgres/postgres_suite_test.go @@ -3,8 +3,8 @@ package postgres_test import ( "testing" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/datastore/postgres/repositories/block_repository.go b/pkg/datastore/postgres/repositories/block_repository.go index 74018296..40570e45 100644 --- a/pkg/datastore/postgres/repositories/block_repository.go +++ b/pkg/datastore/postgres/repositories/block_repository.go @@ -4,7 +4,7 @@ import ( "context" "database/sql" "errors" - "log" + log "github.com/sirupsen/logrus" "github.com/jmoiron/sqlx" diff --git a/pkg/geth/testing/helpers.go b/pkg/geth/testing/helpers.go index 8a683568..ae289962 100644 --- a/pkg/geth/testing/helpers.go +++ b/pkg/geth/testing/helpers.go @@ -1,7 +1,7 @@ package testing import ( - "log" + log "github.com/sirupsen/logrus" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/geth" diff --git a/pkg/history/history_suite_test.go b/pkg/history/history_suite_test.go index 6bf3894c..96068ec7 100644 --- a/pkg/history/history_suite_test.go +++ b/pkg/history/history_suite_test.go @@ -4,8 +4,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" ) diff --git a/pkg/history/populate_headers.go b/pkg/history/populate_headers.go index c4e0612d..01584956 100644 --- a/pkg/history/populate_headers.go +++ b/pkg/history/populate_headers.go @@ -1,7 +1,7 @@ package history import ( - "log" + log "github.com/sirupsen/logrus" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore" @@ -11,7 +11,6 @@ import ( func PopulateMissingHeaders(blockchain core.BlockChain, headerRepository datastore.HeaderRepository, startingBlockNumber int64) (int, error) { lastBlock := blockchain.LastBlock().Int64() blockRange := headerRepository.MissingBlockNumbers(startingBlockNumber, lastBlock, blockchain.Node().ID) - log.SetPrefix("") log.Printf("Backfilling %d blocks\n\n", len(blockRange)) _, err := RetrieveAndUpdateHeaders(blockchain, headerRepository, blockRange) if err != nil { diff --git a/pkg/transformers/bite/bite_suite_test.go b/pkg/transformers/bite/bite_suite_test.go index e5a93b26..a8d60f0d 100644 --- a/pkg/transformers/bite/bite_suite_test.go +++ b/pkg/transformers/bite/bite_suite_test.go @@ -19,8 +19,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestBite(t *testing.T) { diff --git a/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go b/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go index be84066a..d39013e7 100644 --- a/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go +++ b/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go @@ -15,8 +15,8 @@ package chop_lump_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/cat_file/flip/flip_suite_test.go b/pkg/transformers/cat_file/flip/flip_suite_test.go index 29a47e4e..9be529c5 100644 --- a/pkg/transformers/cat_file/flip/flip_suite_test.go +++ b/pkg/transformers/cat_file/flip/flip_suite_test.go @@ -15,8 +15,8 @@ package flip_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go b/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go index 99eaf081..133d7ac5 100644 --- a/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go +++ b/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go @@ -15,8 +15,8 @@ package pit_vow_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/deal/deal_suite_test.go b/pkg/transformers/deal/deal_suite_test.go index 1b987194..064213b2 100644 --- a/pkg/transformers/deal/deal_suite_test.go +++ b/pkg/transformers/deal/deal_suite_test.go @@ -5,8 +5,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestFlipDeal(t *testing.T) { diff --git a/pkg/transformers/dent/dent_suite_test.go b/pkg/transformers/dent/dent_suite_test.go index 40c7e0c5..6fa8d633 100644 --- a/pkg/transformers/dent/dent_suite_test.go +++ b/pkg/transformers/dent/dent_suite_test.go @@ -5,8 +5,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestDent(t *testing.T) { diff --git a/pkg/transformers/drip_drip/drip_drip_suite_test.go b/pkg/transformers/drip_drip/drip_drip_suite_test.go index a1306f99..6d0ee7d7 100644 --- a/pkg/transformers/drip_drip/drip_drip_suite_test.go +++ b/pkg/transformers/drip_drip/drip_drip_suite_test.go @@ -15,8 +15,8 @@ package drip_drip_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/drip_file/ilk/ilk_suite_test.go b/pkg/transformers/drip_file/ilk/ilk_suite_test.go index ab46727e..4327892d 100644 --- a/pkg/transformers/drip_file/ilk/ilk_suite_test.go +++ b/pkg/transformers/drip_file/ilk/ilk_suite_test.go @@ -15,8 +15,8 @@ package ilk_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/drip_file/repo/repo_suite_test.go b/pkg/transformers/drip_file/repo/repo_suite_test.go index cf6edfed..ed554b89 100644 --- a/pkg/transformers/drip_file/repo/repo_suite_test.go +++ b/pkg/transformers/drip_file/repo/repo_suite_test.go @@ -15,8 +15,8 @@ package repo_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/drip_file/vow/vow_suite_test.go b/pkg/transformers/drip_file/vow/vow_suite_test.go index 7c5e4586..7fff6f73 100644 --- a/pkg/transformers/drip_file/vow/vow_suite_test.go +++ b/pkg/transformers/drip_file/vow/vow_suite_test.go @@ -15,8 +15,8 @@ package vow_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/factories/factories_suite_test.go b/pkg/transformers/factories/factories_suite_test.go index 73c5203f..fa938ceb 100644 --- a/pkg/transformers/factories/factories_suite_test.go +++ b/pkg/transformers/factories/factories_suite_test.go @@ -5,8 +5,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestFactories(t *testing.T) { diff --git a/pkg/transformers/factories/log_note_transformer.go b/pkg/transformers/factories/log_note_transformer.go index bc2e1ddb..b237cd87 100644 --- a/pkg/transformers/factories/log_note_transformer.go +++ b/pkg/transformers/factories/log_note_transformer.go @@ -15,7 +15,7 @@ package factories import ( - "log" + log "github.com/sirupsen/logrus" "github.com/ethereum/go-ethereum/common" @@ -41,7 +41,7 @@ func (transformer LogNoteTransformer) Execute() error { transformerName := transformer.Config.TransformerName missingHeaders, err := transformer.Repository.MissingHeaders(transformer.Config.StartingBlockNumber, transformer.Config.EndingBlockNumber) if err != nil { - log.Printf("Error fetching mising headers in %v transformer: %v \n", transformerName, err) + log.Printf("Error fetching mising headers in %v transformer: %v", transformerName, err) return err } @@ -49,7 +49,7 @@ func (transformer LogNoteTransformer) Execute() error { // (Double-array structure required for go-ethereum FilterQuery) var topic = [][]common.Hash{{common.HexToHash(transformer.Config.Topic)}} - log.Printf("Fetching %v event logs for %d headers \n", transformerName, len(missingHeaders)) + log.Printf("Fetching %v event logs for %d headers", transformerName, len(missingHeaders)) for _, header := range missingHeaders { // Fetch the missing logs for a given header matchingLogs, err := transformer.Fetcher.FetchLogs(transformer.Config.ContractAddresses, topic, header) diff --git a/pkg/transformers/factories/transformer.go b/pkg/transformers/factories/transformer.go index 125d7bc1..1fe13236 100644 --- a/pkg/transformers/factories/transformer.go +++ b/pkg/transformers/factories/transformer.go @@ -15,7 +15,7 @@ package factories import ( - "log" + log "github.com/sirupsen/logrus" "github.com/ethereum/go-ethereum/common" diff --git a/pkg/transformers/flap_kick/flap_kick_suite_test.go b/pkg/transformers/flap_kick/flap_kick_suite_test.go index 9baa4235..0d6ba9f0 100644 --- a/pkg/transformers/flap_kick/flap_kick_suite_test.go +++ b/pkg/transformers/flap_kick/flap_kick_suite_test.go @@ -15,8 +15,8 @@ package flap_kick_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/flip_kick/flip_kick_suite_test.go b/pkg/transformers/flip_kick/flip_kick_suite_test.go index f18d530a..ce7e68f1 100644 --- a/pkg/transformers/flip_kick/flip_kick_suite_test.go +++ b/pkg/transformers/flip_kick/flip_kick_suite_test.go @@ -15,8 +15,8 @@ package flip_kick import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/frob/converter.go b/pkg/transformers/frob/converter.go index 419a74a2..00013cab 100644 --- a/pkg/transformers/frob/converter.go +++ b/pkg/transformers/frob/converter.go @@ -18,6 +18,7 @@ import ( "bytes" "encoding/json" "fmt" + log "github.com/sirupsen/logrus" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -30,6 +31,7 @@ type FrobConverter struct{} func (FrobConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { var entities []interface{} + log.Info("blah") for _, ethLog := range ethLogs { entity := FrobEntity{} address := ethLog.Address diff --git a/pkg/transformers/frob/frob_suite_test.go b/pkg/transformers/frob/frob_suite_test.go index db514771..126b1371 100644 --- a/pkg/transformers/frob/frob_suite_test.go +++ b/pkg/transformers/frob/frob_suite_test.go @@ -15,8 +15,8 @@ package frob_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/integration_tests/integration_tests_suite_test.go b/pkg/transformers/integration_tests/integration_tests_suite_test.go index bbc99c1d..454c0798 100644 --- a/pkg/transformers/integration_tests/integration_tests_suite_test.go +++ b/pkg/transformers/integration_tests/integration_tests_suite_test.go @@ -1,7 +1,7 @@ package integration_tests import ( - "log" + log "github.com/sirupsen/logrus" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/integration_tests/vow_flog.go b/pkg/transformers/integration_tests/vow_flog.go index e2a8f903..548086e0 100644 --- a/pkg/transformers/integration_tests/vow_flog.go +++ b/pkg/transformers/integration_tests/vow_flog.go @@ -33,13 +33,13 @@ var _ = Describe("VowFlog LogNoteTransformer", func() { rpcClient, ethClient, err := getClients(ipc) Expect(err).NotTo(HaveOccurred()) - blockchain, err := getBlockChain(rpcClient, ethClient) + blockChain, err := getBlockChain(rpcClient, ethClient) Expect(err).NotTo(HaveOccurred()) - db := test_config.NewTestDB(blockchain.Node()) + db := test_config.NewTestDB(blockChain.Node()) test_config.CleanTestDB(db) - err = persistHeader(db, blockNumber, blockchain) + err = persistHeader(db, blockNumber, blockChain) Expect(err).NotTo(HaveOccurred()) Expect(1).To(Equal(1)) @@ -49,7 +49,7 @@ var _ = Describe("VowFlog LogNoteTransformer", func() { Converter: &vow_flog.VowFlogConverter{}, Repository: &vow_flog.VowFlogRepository{}, } - transformer := initializer.NewLogNoteTransformer(db, blockchain) + transformer := initializer.NewLogNoteTransformer(db, blockChain) err = transformer.Execute() Expect(err).NotTo(HaveOccurred()) diff --git a/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go b/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go index 309ea49a..93ec396f 100644 --- a/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go +++ b/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go @@ -15,8 +15,8 @@ package debt_ceiling_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/pit_file/ilk/ilk_suite_test.go b/pkg/transformers/pit_file/ilk/ilk_suite_test.go index ab46727e..4327892d 100644 --- a/pkg/transformers/pit_file/ilk/ilk_suite_test.go +++ b/pkg/transformers/pit_file/ilk/ilk_suite_test.go @@ -15,8 +15,8 @@ package ilk_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/price_feeds/price_feeds_suite_test.go b/pkg/transformers/price_feeds/price_feeds_suite_test.go index 7aa2e591..c351869e 100644 --- a/pkg/transformers/price_feeds/price_feeds_suite_test.go +++ b/pkg/transformers/price_feeds/price_feeds_suite_test.go @@ -15,8 +15,8 @@ package price_feeds_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/tend/tend_suite_test.go b/pkg/transformers/tend/tend_suite_test.go index 77b4096f..828d2d10 100644 --- a/pkg/transformers/tend/tend_suite_test.go +++ b/pkg/transformers/tend/tend_suite_test.go @@ -1,8 +1,8 @@ package tend_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_flux/vat_flux_suite_test.go b/pkg/transformers/vat_flux/vat_flux_suite_test.go index 9a099bf2..6703caa9 100644 --- a/pkg/transformers/vat_flux/vat_flux_suite_test.go +++ b/pkg/transformers/vat_flux/vat_flux_suite_test.go @@ -1,8 +1,8 @@ package vat_flux_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_fold/vat_fold_suite_test.go b/pkg/transformers/vat_fold/vat_fold_suite_test.go index 97a2aac7..e3ee0832 100644 --- a/pkg/transformers/vat_fold/vat_fold_suite_test.go +++ b/pkg/transformers/vat_fold/vat_fold_suite_test.go @@ -1,8 +1,8 @@ package vat_fold_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_grab/vat_grab_suite_test.go b/pkg/transformers/vat_grab/vat_grab_suite_test.go index 276331d9..428078fe 100644 --- a/pkg/transformers/vat_grab/vat_grab_suite_test.go +++ b/pkg/transformers/vat_grab/vat_grab_suite_test.go @@ -1,8 +1,8 @@ package vat_grab_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_heal/vat_heal_suite_test.go b/pkg/transformers/vat_heal/vat_heal_suite_test.go index fb3fa4d2..047019ea 100644 --- a/pkg/transformers/vat_heal/vat_heal_suite_test.go +++ b/pkg/transformers/vat_heal/vat_heal_suite_test.go @@ -1,8 +1,8 @@ package vat_heal_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_init/vat_init_suite_test.go b/pkg/transformers/vat_init/vat_init_suite_test.go index 356d8fd4..4d5fb572 100644 --- a/pkg/transformers/vat_init/vat_init_suite_test.go +++ b/pkg/transformers/vat_init/vat_init_suite_test.go @@ -15,8 +15,8 @@ package vat_init_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_move/vat_move_suite_test.go b/pkg/transformers/vat_move/vat_move_suite_test.go index c93fbab1..3c3a218a 100644 --- a/pkg/transformers/vat_move/vat_move_suite_test.go +++ b/pkg/transformers/vat_move/vat_move_suite_test.go @@ -15,8 +15,8 @@ package vat_move_test import ( + log "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" diff --git a/pkg/transformers/vat_slip/vat_slip_suite_test.go b/pkg/transformers/vat_slip/vat_slip_suite_test.go index b61fd8c2..e85f3ca4 100644 --- a/pkg/transformers/vat_slip/vat_slip_suite_test.go +++ b/pkg/transformers/vat_slip/vat_slip_suite_test.go @@ -19,8 +19,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestVatSlip(t *testing.T) { diff --git a/pkg/transformers/vat_toll/vat_toll_suite_test.go b/pkg/transformers/vat_toll/vat_toll_suite_test.go index 861e1a01..b5b1e7b0 100644 --- a/pkg/transformers/vat_toll/vat_toll_suite_test.go +++ b/pkg/transformers/vat_toll/vat_toll_suite_test.go @@ -5,8 +5,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestVatToll(t *testing.T) { diff --git a/pkg/transformers/vat_tune/vat_tune_suite_test.go b/pkg/transformers/vat_tune/vat_tune_suite_test.go index c783052b..6dcefa73 100644 --- a/pkg/transformers/vat_tune/vat_tune_suite_test.go +++ b/pkg/transformers/vat_tune/vat_tune_suite_test.go @@ -5,8 +5,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestVatTune(t *testing.T) { diff --git a/pkg/transformers/vow_flog/vow_flog_suite_test.go b/pkg/transformers/vow_flog/vow_flog_suite_test.go index fa12db35..abb962ac 100644 --- a/pkg/transformers/vow_flog/vow_flog_suite_test.go +++ b/pkg/transformers/vow_flog/vow_flog_suite_test.go @@ -19,8 +19,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" "io/ioutil" - "log" ) func TestVowFlog(t *testing.T) { diff --git a/test_config/test_config.go b/test_config/test_config.go index 32e3b524..335b6149 100644 --- a/test_config/test_config.go +++ b/test_config/test_config.go @@ -1,7 +1,7 @@ package test_config import ( - "log" + log "github.com/sirupsen/logrus" "os" . "github.com/onsi/gomega" diff --git a/utils/utils.go b/utils/utils.go index 7652e2ee..30d034f9 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -1,7 +1,7 @@ package utils import ( - "log" + log "github.com/sirupsen/logrus" "path/filepath"