From 9e74b19da0db8d42790f504243ef29507d4136ce Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 5 Oct 2019 17:59:35 +0200 Subject: [PATCH] Improve logs License: MIT Signed-off-by: Jakub Sztandera --- chain/blocksync.go | 2 +- chain/store/store.go | 3 ++- go.mod | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chain/blocksync.go b/chain/blocksync.go index 2565b1335..238d49887 100644 --- a/chain/blocksync.go +++ b/chain/blocksync.go @@ -277,7 +277,7 @@ func (bs *BlockSync) GetBlocks(ctx context.Context, tipset []cid.Cid, count int) } oerr = bs.processStatus(req, res) if oerr != nil { - log.Warnf("BlockSync peer %s response was an error: %s", peers[p].String(), err) + log.Warnf("BlockSync peer %s response was an error: %s", peers[p].String(), oerr) } } return nil, xerrors.Errorf("GetBlocks failed with all peers: %w", oerr) diff --git a/chain/store/store.go b/chain/store/store.go index d82399969..176017c2d 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-lotus/build" "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/chain/state" + "go.uber.org/zap" amt "github.com/filecoin-project/go-amt-ipld" "github.com/filecoin-project/go-lotus/chain/types" @@ -757,7 +758,7 @@ func (cs *ChainStore) GetRandomness(ctx context.Context, blks []cid.Cid, tickets } lt := int64(len(tickets)) if lb < lt { - log.Warn("self sampling randomness. this should be extremely rare, if you see this often it may be a bug") + log.Desugar().Warn("self sampling randomness. this should be extremely rare, if you see this often it may be a bug", zap.Stack("call-stack")) t := tickets[lt-(1+lb)] diff --git a/go.mod b/go.mod index 35d479b3d..1ffbb7fda 100644 --- a/go.mod +++ b/go.mod @@ -76,6 +76,7 @@ require ( go.uber.org/dig v1.7.0 // indirect go.uber.org/fx v1.9.0 go.uber.org/goleak v0.10.0 // indirect + go.uber.org/zap v1.10.0 go4.org v0.0.0-20190313082347-94abd6928b1d // indirect golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect