Merge pull request #4984 from yaohcn/fix-log-warn

fix log format
This commit is contained in:
Łukasz Magiera 2020-11-24 18:01:56 +01:00 committed by GitHub
commit a63ef1dcd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 15 additions and 15 deletions

View File

@ -129,7 +129,7 @@ func (e *Events) listenHeadChangesOnce(ctx context.Context) error {
} }
if err := e.tsc.add(cur[0].Val); err != nil { if err := e.tsc.add(cur[0].Val); err != nil {
log.Warn("tsc.add: adding current tipset failed: %w", err) log.Warnf("tsc.add: adding current tipset failed: %v", err)
} }
e.readyOnce.Do(func() { e.readyOnce.Do(func() {

View File

@ -1331,7 +1331,7 @@ loop:
continue continue
} }
if !xerrors.Is(err, bstore.ErrNotFound) { if !xerrors.Is(err, bstore.ErrNotFound) {
log.Warn("loading local tipset: %s", err) log.Warnf("loading local tipset: %s", err)
} }
// NB: GetBlocks validates that the blocks are in-fact the ones we // NB: GetBlocks validates that the blocks are in-fact the ones we

View File

@ -87,7 +87,7 @@ var runCmd = &cli.Command{
return err return err
} }
log.Info("Remote version: %s", v.Version) log.Infof("Remote version: %s", v.Version)
from, err := address.NewFromString(cctx.String("from")) from, err := address.NewFromString(cctx.String("from"))
if err != nil { if err != nil {

View File

@ -366,7 +366,7 @@ func importKey(ctx context.Context, api api.FullNode, f string) error {
return err return err
} }
log.Info("successfully imported key for %s", addr) log.Infof("successfully imported key for %s", addr)
return nil return nil
} }

View File

@ -146,7 +146,7 @@ func (m *Manager) getWork(ctx context.Context, method sealtasks.TaskType, params
switch ws.Status { switch ws.Status {
case wsStarted: case wsStarted:
log.Warn("canceling started (not running) work %s", wid) log.Warnf("canceling started (not running) work %s", wid)
if err := m.work.Get(wid).End(); err != nil { if err := m.work.Get(wid).End(); err != nil {
log.Errorf("cancel: failed to cancel started work %s: %+v", wid, err) log.Errorf("cancel: failed to cancel started work %s: %+v", wid, err)
@ -154,9 +154,9 @@ func (m *Manager) getWork(ctx context.Context, method sealtasks.TaskType, params
} }
case wsDone: case wsDone:
// TODO: still remove? // TODO: still remove?
log.Warn("cancel called on work %s in 'done' state", wid) log.Warnf("cancel called on work %s in 'done' state", wid)
case wsRunning: case wsRunning:
log.Warn("cancel called on work %s in 'running' state (manager shutting down?)", wid) log.Warnf("cancel called on work %s in 'running' state (manager shutting down?)", wid)
} }
}, nil }, nil

View File

@ -437,7 +437,7 @@ func (sh *scheduler) trySched() {
r, err := task.sel.Cmp(rpcCtx, task.taskType, wi, wj) r, err := task.sel.Cmp(rpcCtx, task.taskType, wi, wj)
if err != nil { if err != nil {
log.Error("selecting best worker: %s", err) log.Errorf("selecting best worker: %s", err)
} }
return r return r
}) })

View File

@ -368,7 +368,7 @@ assignLoop:
err := sw.startProcessingTask(sw.taskDone, todo) err := sw.startProcessingTask(sw.taskDone, todo)
if err != nil { if err != nil {
log.Error("startProcessingTask error: %+v", err) log.Errorf("startProcessingTask error: %+v", err)
go todo.respond(xerrors.Errorf("startProcessingTask error: %w", err)) go todo.respond(xerrors.Errorf("startProcessingTask error: %w", err))
} }

View File

@ -357,7 +357,7 @@ func (m *Sealing) newDealSector(ctx context.Context) (abi.SectorNumber, abi.Sect
m.unsealedInfoMap.lk.Unlock() m.unsealedInfoMap.lk.Unlock()
if err := m.StartPacking(best); err != nil { if err := m.StartPacking(best); err != nil {
log.Error("newDealSector StartPacking error: %+v", err) log.Errorf("newDealSector StartPacking error: %+v", err)
continue // let's pretend this is fine continue // let's pretend this is fine
} }
m.unsealedInfoMap.lk.Lock() m.unsealedInfoMap.lk.Lock()

View File

@ -137,12 +137,12 @@ func (m *Sealing) handlePreCommitFailed(ctx statemachine.Context, sector SectorI
if pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil { if pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil {
if sector.PreCommitMessage == nil { if sector.PreCommitMessage == nil {
log.Warn("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorNumber) log.Warnf("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorNumber)
return ctx.Send(SectorPreCommitLanded{TipSet: tok}) return ctx.Send(SectorPreCommitLanded{TipSet: tok})
} }
if pci.Info.SealedCID != *sector.CommR { if pci.Info.SealedCID != *sector.CommR {
log.Warn("sector %d is precommitted on chain, with different CommR: %x != %x", sector.SectorNumber, pci.Info.SealedCID, sector.CommR) log.Warnf("sector %d is precommitted on chain, with different CommR: %x != %x", sector.SectorNumber, pci.Info.SealedCID, sector.CommR)
return nil // TODO: remove when the actor allows re-precommit return nil // TODO: remove when the actor allows re-precommit
} }
@ -387,7 +387,7 @@ func (m *Sealing) handleRecoverDealIDs(ctx statemachine.Context, sector SectorIn
if p.DealInfo.PublishCid == nil { if p.DealInfo.PublishCid == nil {
// TODO: check if we are in an early enough state try to remove this piece // TODO: check if we are in an early enough state try to remove this piece
log.Error("can't fix sector deals: piece %d (of %d) of sector %d has nil DealInfo.PublishCid (refers to deal %d)", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID) log.Errorf("can't fix sector deals: piece %d (of %d) of sector %d has nil DealInfo.PublishCid (refers to deal %d)", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID)
// Not much to do here (and this can only happen for old spacerace sectors) // Not much to do here (and this can only happen for old spacerace sectors)
return ctx.Send(SectorRemove{}) return ctx.Send(SectorRemove{})
} }

View File

@ -128,7 +128,7 @@ func ReaderParamDecoder() (http.HandlerFunc, jsonrpc.ServerOption) {
case ch <- wr: case ch <- wr:
case <-tctx.Done(): case <-tctx.Done():
close(ch) close(ch)
log.Error("context error in reader stream handler (1): %v", tctx.Err()) log.Errorf("context error in reader stream handler (1): %v", tctx.Err())
resp.WriteHeader(500) resp.WriteHeader(500)
return return
} }
@ -136,7 +136,7 @@ func ReaderParamDecoder() (http.HandlerFunc, jsonrpc.ServerOption) {
select { select {
case <-wr.wait: case <-wr.wait:
case <-req.Context().Done(): case <-req.Context().Done():
log.Error("context error in reader stream handler (2): %v", req.Context().Err()) log.Errorf("context error in reader stream handler (2): %v", req.Context().Err())
resp.WriteHeader(500) resp.WriteHeader(500)
return return
} }