Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error logging format strings #5582

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chain/market/fundmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (a *fundedAddress) saveState() {
// Not much we can do if saving to the datastore fails, just log
err := a.str.save(a.state)
if err != nil {
log.Errorf("saving state to store for addr %s: %w", a.state.Addr, err)
log.Errorf("saving state to store for addr %s: %v", a.state.Addr, err)
}
}

Expand Down Expand Up @@ -579,7 +579,7 @@ func (a *fundedAddress) startWaitForResults(msgCid cid.Cid) {
if err != nil {
// We don't really care about the results here, we're just waiting
// so as to only process one on-chain message at a time
log.Errorf("waiting for results of message %s for addr %s: %w", msgCid, a.state.Addr, err)
log.Errorf("waiting for results of message %s for addr %s: %v", msgCid, a.state.Addr, err)
}

a.lk.Lock()
Expand Down
2 changes: 1 addition & 1 deletion chain/messagepool/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
// the balance
a, err := mp.api.GetActorAfter(actor, ts)
if err != nil {
log.Errorf("failed to load actor state, not building chain for %s: %w", actor, err)
log.Errorf("failed to load actor state, not building chain for %s: %v", actor, err)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion chain/stmgr/stmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (sm *StateManager) WaitForMessage(ctx context.Context, mcid cid.Cid, confid
go func() {
fts, r, foundMsg, err := sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit)
if err != nil {
log.Warnf("failed to look back through chain for message: %w", err)
log.Warnf("failed to look back through chain for message: %v", err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion cli/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var logSetLevel = &cli.Command{

for _, system := range systems {
if err := api.LogSetLevel(ctx, system, cctx.Args().First()); err != nil {
return xerrors.Errorf("setting log level on %s: %w", system, err)
return xerrors.Errorf("setting log level on %s: %v", system, err)
}
}

Expand Down
12 changes: 6 additions & 6 deletions cmd/lotus-chainwatch/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandleMarketChanges(ctx, actorChanges[builtin2.StorageMarketActorCodeID]); err != nil {
log.Errorf("Failed to handle market changes: %w", err)
log.Errorf("Failed to handle market changes: %v", err)
return
}
}()
Expand All @@ -155,7 +155,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandleMinerChanges(ctx, actorChanges[builtin2.StorageMinerActorCodeID]); err != nil {
log.Errorf("Failed to handle miner changes: %w", err)
log.Errorf("Failed to handle miner changes: %v", err)
return
}
}()
Expand All @@ -164,7 +164,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandleRewardChanges(ctx, actorChanges[builtin2.RewardActorCodeID], nullRounds); err != nil {
log.Errorf("Failed to handle reward changes: %w", err)
log.Errorf("Failed to handle reward changes: %v", err)
return
}
}()
Expand All @@ -173,7 +173,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandlePowerChanges(ctx, actorChanges[builtin2.StoragePowerActorCodeID]); err != nil {
log.Errorf("Failed to handle power actor changes: %w", err)
log.Errorf("Failed to handle power actor changes: %v", err)
return
}
}()
Expand All @@ -182,7 +182,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandleMessageChanges(ctx, toProcess); err != nil {
log.Errorf("Failed to handle message changes: %w", err)
log.Errorf("Failed to handle message changes: %v", err)
return
}
}()
Expand All @@ -191,7 +191,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() {
defer grp.Done()
if err := p.HandleCommonActorsChanges(ctx, actorChanges); err != nil {
log.Errorf("Failed to handle common actor changes: %w", err)
log.Errorf("Failed to handle common actor changes: %v", err)
return
}
}()
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-shed/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ var jwtNewCmd = &cli.Command{

defer func() {
if err := file.Close(); err != nil {
log.Warnf("failed to close output file: %w", err)
log.Warnf("failed to close output file: %v", err)
}
}()

Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-shed/keyinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ var keyinfoNewCmd = &cli.Command{

defer func() {
if err := file.Close(); err != nil {
log.Warnf("failed to close output file: %w", err)
log.Warnf("failed to close output file: %v", err)
}
}()

Expand Down
2 changes: 1 addition & 1 deletion markets/storageadapter/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema
for time.Since(curTime) < addPieceRetryTimeout {
if !xerrors.Is(err, sealing.ErrTooManySectorsSealing) {
if err != nil {
log.Errorf("failed to addPiece for deal %d, err: %w", deal.DealID, err)
log.Errorf("failed to addPiece for deal %d, err: %v", deal.DealID, err)
}
break
}
Expand Down
6 changes: 3 additions & 3 deletions node/modules/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ func HandleMigrateClientFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, wallet full
if xerrors.Is(err, datastore.ErrNotFound) {
return nil
}
log.Errorf("client funds migration - getting datastore value: %w", err)
log.Errorf("client funds migration - getting datastore value: %v", err)
return nil
}

var value abi.TokenAmount
if err = value.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
log.Errorf("client funds migration - unmarshalling datastore value: %w", err)
log.Errorf("client funds migration - unmarshalling datastore value: %v", err)
return nil
}
_, err = fundMgr.Reserve(ctx, addr, addr, value)
if err != nil {
log.Errorf("client funds migration - reserving funds (wallet %s, addr %s, funds %d): %w",
log.Errorf("client funds migration - reserving funds (wallet %s, addr %s, funds %d): %v",
addr, addr, value, err)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions node/modules/storageminer.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,19 @@ func HandleMigrateProviderFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, node api.
}
ts, err := node.ChainHead(ctx)
if err != nil {
log.Errorf("provider funds migration - getting chain head: %w", err)
log.Errorf("provider funds migration - getting chain head: %v", err)
return nil
}

mi, err := node.StateMinerInfo(ctx, address.Address(minerAddress), ts.Key())
if err != nil {
log.Errorf("provider funds migration - getting miner info %s: %w", minerAddress, err)
log.Errorf("provider funds migration - getting miner info %s: %v", minerAddress, err)
return nil
}

_, err = node.MarketReserveFunds(ctx, mi.Worker, address.Address(minerAddress), value)
if err != nil {
log.Errorf("provider funds migration - reserving funds (wallet %s, addr %s, funds %d): %w",
log.Errorf("provider funds migration - reserving funds (wallet %s, addr %s, funds %d): %v",
mi.Worker, minerAddress, value, err)
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion paychmgr/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (ca *channelAccessor) waitForPaychCreateMsg(channelID string, mcid cid.Cid)
func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error {
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence)
if err != nil {
log.Errorf("wait msg: %w", err)
log.Errorf("wait msg: %v", err)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *WindowPoStScheduler) failPost(err error, ts *types.TipSet, deadline *dl
}
})

log.Errorf("Got err %w - TODO handle errors", err)
log.Errorf("Got err %+v - TODO handle errors", err)
/*s.failLk.Lock()
if eps > s.failed {
s.failed = eps
Expand Down