Fix error logging format strings

This commit is contained in:
Łukasz Magiera 2021-02-11 12:00:26 +01:00
parent fcbd9950ca
commit 0c6aef221d
12 changed files with 22 additions and 22 deletions

View File

@ -324,7 +324,7 @@ func (a *fundedAddress) saveState() {
// Not much we can do if saving to the datastore fails, just log // Not much we can do if saving to the datastore fails, just log
err := a.str.save(a.state) err := a.str.save(a.state)
if err != nil { 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)
} }
} }
@ -579,7 +579,7 @@ func (a *fundedAddress) startWaitForResults(msgCid cid.Cid) {
if err != nil { if err != nil {
// We don't really care about the results here, we're just waiting // 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 // 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() a.lk.Lock()

View File

@ -719,7 +719,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
// the balance // the balance
a, err := mp.api.GetActorAfter(actor, ts) a, err := mp.api.GetActorAfter(actor, ts)
if err != nil { 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 return nil
} }

View File

@ -621,7 +621,7 @@ func (sm *StateManager) WaitForMessage(ctx context.Context, mcid cid.Cid, confid
go func() { go func() {
fts, r, foundMsg, err := sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit) fts, r, foundMsg, err := sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit)
if err != nil { 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 return
} }

View File

@ -93,7 +93,7 @@ var logSetLevel = &cli.Command{
for _, system := range systems { for _, system := range systems {
if err := api.LogSetLevel(ctx, system, cctx.Args().First()); err != nil { 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)
} }
} }

View File

@ -146,7 +146,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleMarketChanges(ctx, actorChanges[builtin2.StorageMarketActorCodeID]); err != nil { 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 return
} }
}() }()
@ -155,7 +155,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleMinerChanges(ctx, actorChanges[builtin2.StorageMinerActorCodeID]); err != nil { 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 return
} }
}() }()
@ -164,7 +164,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleRewardChanges(ctx, actorChanges[builtin2.RewardActorCodeID], nullRounds); err != nil { 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 return
} }
}() }()
@ -173,7 +173,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandlePowerChanges(ctx, actorChanges[builtin2.StoragePowerActorCodeID]); err != nil { 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 return
} }
}() }()
@ -182,7 +182,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleMessageChanges(ctx, toProcess); err != nil { 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 return
} }
}() }()
@ -191,7 +191,7 @@ func (p *Processor) Start(ctx context.Context) {
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleCommonActorsChanges(ctx, actorChanges); err != nil { 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 return
} }
}() }()

View File

@ -168,7 +168,7 @@ var jwtNewCmd = &cli.Command{
defer func() { defer func() {
if err := file.Close(); err != nil { if err := file.Close(); err != nil {
log.Warnf("failed to close output file: %w", err) log.Warnf("failed to close output file: %v", err)
} }
}() }()

View File

@ -427,7 +427,7 @@ var keyinfoNewCmd = &cli.Command{
defer func() { defer func() {
if err := file.Close(); err != nil { if err := file.Close(); err != nil {
log.Warnf("failed to close output file: %w", err) log.Warnf("failed to close output file: %v", err)
} }
}() }()

View File

@ -104,7 +104,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema
for time.Since(curTime) < addPieceRetryTimeout { for time.Since(curTime) < addPieceRetryTimeout {
if !xerrors.Is(err, sealing.ErrTooManySectorsSealing) { if !xerrors.Is(err, sealing.ErrTooManySectorsSealing) {
if err != nil { 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 break
} }

View File

@ -58,18 +58,18 @@ func HandleMigrateClientFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, wallet full
if xerrors.Is(err, datastore.ErrNotFound) { if xerrors.Is(err, datastore.ErrNotFound) {
return nil return nil
} }
log.Errorf("client funds migration - getting datastore value: %w", err) log.Errorf("client funds migration - getting datastore value: %v", err)
return nil return nil
} }
var value abi.TokenAmount var value abi.TokenAmount
if err = value.UnmarshalCBOR(bytes.NewReader(b)); err != nil { 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 return nil
} }
_, err = fundMgr.Reserve(ctx, addr, addr, value) _, err = fundMgr.Reserve(ctx, addr, addr, value)
if err != nil { 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) addr, addr, value, err)
return nil return nil
} }

View File

@ -293,19 +293,19 @@ func HandleMigrateProviderFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, node api.
} }
ts, err := node.ChainHead(ctx) ts, err := node.ChainHead(ctx)
if err != nil { 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 return nil
} }
mi, err := node.StateMinerInfo(ctx, address.Address(minerAddress), ts.Key()) mi, err := node.StateMinerInfo(ctx, address.Address(minerAddress), ts.Key())
if err != nil { 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 return nil
} }
_, err = node.MarketReserveFunds(ctx, mi.Worker, address.Address(minerAddress), value) _, err = node.MarketReserveFunds(ctx, mi.Worker, address.Address(minerAddress), value)
if err != nil { 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) mi.Worker, minerAddress, value, err)
return nil return nil
} }

View File

@ -415,7 +415,7 @@ func (ca *channelAccessor) waitForPaychCreateMsg(channelID string, mcid cid.Cid)
func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error { func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error {
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence) mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence)
if err != nil { if err != nil {
log.Errorf("wait msg: %w", err) log.Errorf("wait msg: %v", err)
return err return err
} }

View File

@ -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() /*s.failLk.Lock()
if eps > s.failed { if eps > s.failed {
s.failed = eps s.failed = eps