Add logging for every transformer

- Also add drip file transformer initializer
This commit is contained in:
Rob Mulholand 2018-09-18 15:48:48 -05:00
parent a735698f77
commit 56c45b6841
26 changed files with 125 additions and 3 deletions

View File

@ -17,11 +17,13 @@
package bite
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"log"
)
type BiteTransformer struct {
@ -58,6 +60,7 @@ func (b BiteTransformer) Execute() error {
return err
}
log.Printf("Fetching bite event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
ethLogs, err := b.Fetcher.FetchLogs(config.ContractAddress, topics, header.BlockNumber)
if err != nil {

View File

@ -15,11 +15,13 @@
package deal
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"log"
)
type DealTransformer struct {
@ -54,6 +56,7 @@ func (t DealTransformer) Execute() error {
return err
}
log.Printf("Fetching deal event logs for %d headers \n", len(headers))
for _, header := range headers {
ethLogs, err := t.Fetcher.FetchLogs(config.ContractAddress, topics, header.BlockNumber)
if err != nil {

View File

@ -51,6 +51,7 @@ func (t DentTransformer) Execute() error {
config := t.Config
topics := [][]common.Hash{{common.HexToHash(shared.DentFunctionSignature)}}
headers, err := t.Repository.MissingHeaders(config.StartingBlockNumber, config.EndingBlockNumber)
log.Printf("Fetching dent event logs for %d headers \n", len(headers))
for _, header := range headers {
ethLogs, err := t.Fetcher.FetchLogs(config.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package drip_drip_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestDripDrip(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DripDrip Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,7 +15,10 @@
package drip_drip
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
@ -49,6 +52,7 @@ func (transformer DripDripTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching drip drip event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.DripDripSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(transformer.Config.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package ilk_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestIlk(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Ilk Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,7 +15,10 @@
package ilk
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file"
@ -50,6 +53,7 @@ func (transformer DripFileIlkTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching drip file ilk event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.DripFileIlkSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(drip_file.DripFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package repo_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestRepo(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Repo Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,7 +15,10 @@
package repo
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file"
@ -50,6 +53,7 @@ func (transformer DripFileRepoTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching drip file repo event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.DripFileRepoSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(drip_file.DripFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,11 +15,32 @@
package vow
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
)
type DripFileVowTransformerInitializer struct {
Config shared.TransformerConfig
}
func (initializer DripFileVowTransformerInitializer) NewDripFileVowTransformer(db *postgres.DB, blockChain core.BlockChain) shared.Transformer {
converter := DripFileVowConverter{}
fetcher := shared.NewFetcher(blockChain)
repository := NewDripFileVowRepository(db)
return DripFileVowTransformer{
Config: initializer.Config,
Converter: converter,
Fetcher: fetcher,
Repository: repository,
}
}
type DripFileVowTransformer struct {
Config shared.TransformerConfig
Converter Converter
@ -32,6 +53,7 @@ func (transformer DripFileVowTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching drip file vow event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.DripFileVowSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(drip_file.DripFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package vow_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestVow(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Vow Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -88,7 +88,7 @@ func (fkt FlipKickTransformer) Execute() error {
return err
}
log.Printf("Fetching event logs for %d headers \n", len(headers))
log.Printf("Fetching flip kick event logs for %d headers \n", len(headers))
var resultingErrors []error
for _, header := range headers {
ethLogs, err := fkt.Fetcher.FetchLogs(config.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package frob_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestFrob(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Frob Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,6 +15,8 @@
package frob
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
@ -50,6 +52,7 @@ func (transformer FrobTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching frob event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.FrobSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(FrobConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package debt_ceiling_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestDebtCeiling(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DebtCeiling Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,6 +15,8 @@
package debt_ceiling
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
@ -51,6 +53,7 @@ func (transformer PitFileDebtCeilingTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching pit file debt ceiling event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.PitFileDebtCeilingSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(pit_file.PitFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package ilk_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestIlk(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Ilk Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,6 +15,8 @@
package ilk
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
@ -51,6 +53,7 @@ func (transformer PitFileIlkTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching pit file ilk event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.PitFileIlkSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(pit_file.PitFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package stability_fee_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestStabilityFee(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "StabilityFee Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,6 +15,8 @@
package stability_fee
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
@ -51,6 +53,7 @@ func (transformer PitFileStabilityFeeTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching pit file stability fee event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.PitFileStabilityFeeSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(pit_file.PitFileConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package price_feeds_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestPriceFeeds(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "PriceFeeds Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})

View File

@ -15,6 +15,8 @@
package price_feeds
import (
"log"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
@ -48,6 +50,7 @@ func (transformer PriceFeedTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching price feed event logs for %d headers \n", len(headers))
for _, header := range headers {
logs, err := transformer.Fetcher.FetchLogValues(header.BlockNumber)
if err != nil {

View File

@ -57,6 +57,7 @@ func (t TendTransformer) Execute() error {
return err
}
log.Printf("Fetching tend event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
ethLogs, err := t.Fetcher.FetchLogs(config.ContractAddress, topics, header.BlockNumber)
if err != nil {

View File

@ -22,6 +22,7 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file"
ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk"
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo"
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow"
"github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick"
"github.com/vulcanize/vulcanizedb/pkg/transformers/frob"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file"
@ -42,6 +43,7 @@ var (
dripFileConfig = drip_file.DripFileConfig
DripFileIlkTransformerInitializer = ilk2.DripFileIlkTransformerInitializer{Config: dripFileConfig}.NewDripFileIlkTransformer
DripFileRepoTransformerInitializer = repo.DripFileRepoTransformerInitializer{Config: dripFileConfig}.NewDripFileRepoTransformer
DripFileVowTransfromerInitializer = vow.DripFileVowTransformerInitializer{Config: dripFileConfig}.NewDripFileVowTransformer
FlipKickTransformerInitializer = flip_kick.FlipKickTransformerInitializer{Config: flip_kick.FlipKickConfig}.NewFlipKickTransformer
FrobTransformerInitializer = frob.FrobTransformerInitializer{Config: frob.FrobConfig}.NewFrobTransformer
pitFileConfig = pit_file.PitFileConfig

View File

@ -15,6 +15,8 @@
package vat_init
import (
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/vulcanize/vulcanizedb/pkg/core"
@ -50,6 +52,7 @@ func (transformer VatInitTransformer) Execute() error {
if err != nil {
return err
}
log.Printf("Fetching vat init event logs for %d headers \n", len(missingHeaders))
for _, header := range missingHeaders {
topics := [][]common.Hash{{common.HexToHash(shared.VatInitSignature)}}
matchingLogs, err := transformer.Fetcher.FetchLogs(VatInitConfig.ContractAddress, topics, header.BlockNumber)

View File

@ -15,6 +15,8 @@
package vat_init_test
import (
"io/ioutil"
"log"
"testing"
. "github.com/onsi/ginkgo"
@ -25,3 +27,7 @@ func TestVatInit(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "VatInit Suite")
}
var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})