Adds ability to set log level from toml or CLI args
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package history
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
@@ -35,7 +36,7 @@ func PopulateMissingBlocks(blockchain core.BlockChain, blockRepository datastore
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
log.Printf("Backfilling %d blocks\n\n", len(blockRange))
|
||||
log.Debug(getBlockRangeString(blockRange))
|
||||
_, err = RetrieveAndUpdateBlocks(blockchain, blockRepository, blockRange)
|
||||
if err != nil {
|
||||
log.Error("PopulateMissingBlocks: error gettings/updating blocks: ", err)
|
||||
@@ -61,3 +62,7 @@ func RetrieveAndUpdateBlocks(blockchain core.BlockChain, blockRepository datasto
|
||||
}
|
||||
return len(blockNumbers), nil
|
||||
}
|
||||
|
||||
func getBlockRangeString(blockRange []int64) string {
|
||||
return fmt.Sprintf("Backfilling |%v| blocks", len(blockRange))
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func PopulateMissingHeaders(blockChain core.BlockChain, headerRepository datasto
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
log.Printf("Backfilling %d blocks\n\n", len(blockNumbers))
|
||||
log.Debug(getBlockRangeString(blockNumbers))
|
||||
_, err = RetrieveAndUpdateHeaders(blockChain, headerRepository, blockNumbers)
|
||||
if err != nil {
|
||||
log.Error("PopulateMissingHeaders: Error getting/updating headers:", err)
|
||||
@@ -61,3 +61,4 @@ func RetrieveAndUpdateHeaders(blockChain core.BlockChain, headerRepository datas
|
||||
}
|
||||
return len(blockNumbers), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,6 @@ func MakeRange(min, max int64) []int64 {
|
||||
}
|
||||
|
||||
func (window ValidationWindow) GetString() string {
|
||||
return fmt.Sprintf("Validating Blocks |%v|-- Validation Window --|%v}|",
|
||||
return fmt.Sprintf("Validating Blocks |%v|-- Validation Window --|%v|",
|
||||
window.LowerBound, window.UpperBound)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user