From c1024c24e5938f0f259bbaa4dfa3137b52c70a45 Mon Sep 17 00:00:00 2001 From: "Leo Zhang (zhangchiqing)" Date: Fri, 7 Jun 2024 21:45:37 -0700 Subject: [PATCH] update log --- cmd/util/cmd/find-trie-root/cmd.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/util/cmd/find-trie-root/cmd.go b/cmd/util/cmd/find-trie-root/cmd.go index f186114407b..fc69fa6ddcf 100644 --- a/cmd/util/cmd/find-trie-root/cmd.go +++ b/cmd/util/cmd/find-trie-root/cmd.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "fmt" "math" + "os" prometheusWAL "github.com/onflow/wal/wal" "github.com/prometheus/client_golang/prometheus" @@ -85,8 +86,8 @@ func searchRootHashInSegments( dir string, wantFrom, wantTo int, ) (int, int64, error) { - log := zerolog.Logger{} - w, err := prometheusWAL.NewSize(log, prometheus.DefaultRegisterer, dir, wal.SegmentSize, false) + lg := zerolog.New(os.Stderr).With().Timestamp().Logger() + w, err := prometheusWAL.NewSize(lg, prometheus.DefaultRegisterer, dir, wal.SegmentSize, false) if err != nil { return 0, 0, fmt.Errorf("cannot create WAL: %w", err) } @@ -120,7 +121,7 @@ func searchRootHashInSegments( Int("want-to", wantTo). Msgf("searching for trie root hash %x in segments [%d,%d]", expectedHash, wantFrom, wantTo) - sr, err := prometheusWAL.NewSegmentsRangeReader(log, prometheusWAL.SegmentRange{ + sr, err := prometheusWAL.NewSegmentsRangeReader(lg, prometheusWAL.SegmentRange{ Dir: w.Dir(), First: from, Last: to,