diff --git a/cmd/lightSync.go b/cmd/lightSync.go index ff337640..1b10163b 100644 --- a/cmd/lightSync.go +++ b/cmd/lightSync.go @@ -17,7 +17,6 @@ package cmd import ( - "os" "time" log "github.com/sirupsen/logrus" @@ -87,7 +86,7 @@ func lightSync() { if err != nil { log.Error("ValidateHeaders failed in lightSync: ", err) } - window.Log(os.Stdout) + log.Info(window.GetString()) case n := <-missingBlocksPopulated: if n == 0 { time.Sleep(3 * time.Second) diff --git a/cmd/sync.go b/cmd/sync.go index 243ffb2e..8e1840d3 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -17,7 +17,6 @@ package cmd import ( - "os" "time" log "github.com/sirupsen/logrus" @@ -87,7 +86,7 @@ func sync() { select { case <-ticker.C: window := validator.ValidateBlocks() - window.Log(os.Stdout) + log.Info(window.GetString()) case <-missingBlocksPopulated: go backFillAllBlocks(blockChain, blockRepository, missingBlocksPopulated, startingBlockNumber) } diff --git a/pkg/history/validation_window.go b/pkg/history/validation_window.go index fb843907..f6ba1a18 100644 --- a/pkg/history/validation_window.go +++ b/pkg/history/validation_window.go @@ -17,8 +17,8 @@ package history import ( + "fmt" "github.com/vulcanize/vulcanizedb/pkg/core" - "io" "text/template" ) @@ -52,6 +52,7 @@ func MakeRange(min, max int64) []int64 { return a } -func (window ValidationWindow) Log(out io.Writer) { - ParsedWindowTemplate.Execute(out, window) +func (window ValidationWindow) GetString() string { + return fmt.Sprintf("Validating Blocks |%v|-- Validation Window --|%v}|", + window.LowerBound, window.UpperBound) } diff --git a/pkg/history/validation_window_test.go b/pkg/history/validation_window_test.go index 55434f34..50683be4 100644 --- a/pkg/history/validation_window_test.go +++ b/pkg/history/validation_window_test.go @@ -17,8 +17,6 @@ package history_test import ( - "bytes" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -50,15 +48,4 @@ var _ = Describe("Validation window", func() { Expect(numberOfBlocksCreated).To(Equal(expected)) }) - - It("logs window message", func() { - expectedMessage := &bytes.Buffer{} - window := history.ValidationWindow{LowerBound: 5, UpperBound: 7} - history.ParsedWindowTemplate.Execute(expectedMessage, window) - actualMessage := &bytes.Buffer{} - - window.Log(actualMessage) - - Expect(actualMessage).To(Equal(expectedMessage)) - }) })