forked from TrueCloudLab/frostfs-node
[#1502] Use zap.Error
for logging errors
Use `zap.Error` instead of `zap.String` for logging errors: change all expressions like `zap.String("error", err.Error())` or `zap.String("err", err.Error())` to `zap.Error(err)`. Leave similar expressions with other messages unchanged, for example, `zap.String("last_error", lastErr.Error())` or `zap.String("reason", ctx.Err().Error())`. This change was made by applying the following patch: ```diff @@ var err expression @@ -zap.String("error", err.Error()) +zap.Error(err) @@ var err expression @@ -zap.String("err", err.Error()) +zap.Error(err) ``` Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
8ba9f31fca
commit
f0c43c8d80
56 changed files with 114 additions and 114 deletions
|
@ -33,7 +33,7 @@ func (ap *Processor) processEmit(ctx context.Context) bool {
|
|||
// there is no signature collecting, so we don't need extra fee
|
||||
_, err := ap.morphClient.Invoke(ctx, contract, 0, emitMethod)
|
||||
if err != nil {
|
||||
ap.log.Warn(ctx, logs.AlphabetCantInvokeAlphabetEmitMethod, zap.String("error", err.Error()))
|
||||
ap.log.Warn(ctx, logs.AlphabetCantInvokeAlphabetEmitMethod, zap.Error(err))
|
||||
|
||||
return false
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func (ap *Processor) processEmit(ctx context.Context) bool {
|
|||
networkMap, err := ap.netmapClient.NetMap()
|
||||
if err != nil {
|
||||
ap.log.Warn(ctx, logs.AlphabetCantGetNetmapSnapshotToEmitGasToStorageNodes,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
|
||||
return false
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ func (ap *Processor) transferGasToNetmapNodes(ctx context.Context, nmNodes []net
|
|||
key, err := keys.NewPublicKeyFromBytes(keyBytes, elliptic.P256())
|
||||
if err != nil {
|
||||
ap.log.Warn(ctx, logs.AlphabetCantParseNodePublicKey,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ func (ap *Processor) transferGasToNetmapNodes(ctx context.Context, nmNodes []net
|
|||
ap.log.Warn(ctx, logs.AlphabetCantTransferGas,
|
||||
zap.String("receiver", key.Address()),
|
||||
zap.Int64("amount", int64(gasPerNode)),
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (ap *Processor) transferGasToExtraNodes(ctx context.Context, pw []util.Uint
|
|||
ap.log.Warn(ctx, logs.AlphabetCantTransferGasToWallet,
|
||||
zap.Strings("receivers", receiversLog),
|
||||
zap.Int64("amount", int64(gasPerNode)),
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func (cp *Processor) processContainerPut(ctx context.Context, put putEvent) bool
|
|||
err := cp.checkPutContainer(pctx)
|
||||
if err != nil {
|
||||
cp.log.Error(ctx, logs.ContainerPutContainerCheckFailed,
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
||||
return false
|
||||
|
@ -58,7 +58,7 @@ func (cp *Processor) processContainerPut(ctx context.Context, put putEvent) bool
|
|||
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(pctx.e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(ctx, logs.ContainerCouldNotApprovePutContainer,
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ func (cp *Processor) processContainerDelete(ctx context.Context, e containerEven
|
|||
err := cp.checkDeleteContainer(e)
|
||||
if err != nil {
|
||||
cp.log.Error(ctx, logs.ContainerDeleteContainerCheckFailed,
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
||||
return false
|
||||
|
@ -121,7 +121,7 @@ func (cp *Processor) processContainerDelete(ctx context.Context, e containerEven
|
|||
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(ctx, logs.ContainerCouldNotApproveDeleteContainer,
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
||||
return false
|
||||
|
|
|
@ -73,7 +73,7 @@ func (np *Processor) processDeposit(ctx context.Context, deposit frostfsEvent.De
|
|||
err = np.morphClient.TransferGas(receiver, np.mintEmitValue)
|
||||
if err != nil {
|
||||
np.log.Error(ctx, logs.FrostFSCantTransferNativeGasToReceiver,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -28,21 +28,21 @@ func (gp *Processor) processAlphabetSync(ctx context.Context, txHash util.Uint25
|
|||
mainnetAlphabet, err := gp.mainnetClient.NeoFSAlphabetList()
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantFetchAlphabetListFromMainNet,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
sidechainAlphabet, err := gp.morphClient.Committee()
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantFetchAlphabetListFromSideChain,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
newAlphabet, err := newAlphabetList(sidechainAlphabet, mainnetAlphabet)
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantMergeAlphabetListsFromMainNetAndSideChain,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ func (gp *Processor) processAlphabetSync(ctx context.Context, txHash util.Uint25
|
|||
err = gp.voter.VoteForSidechainValidator(ctx, votePrm)
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantVoteForSideChainCommittee,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
// 2. Update NeoFSAlphabet role in the sidechain.
|
||||
|
@ -98,14 +98,14 @@ func (gp *Processor) updateNeoFSAlphabetRoleInSidechain(ctx context.Context, sid
|
|||
innerRing, err := gp.irFetcher.InnerRingKeys()
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantFetchInnerRingListFromSideChain,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
newInnerRing, err := updateInnerRing(innerRing, sidechainAlphabet, newAlphabet)
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantCreateNewInnerRingListWithNewAlphabetKeys,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ func (gp *Processor) updateNeoFSAlphabetRoleInSidechain(ctx context.Context, sid
|
|||
|
||||
if err = gp.morphClient.UpdateNeoFSAlphabetList(ctx, updPrm); err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantUpdateInnerRingListWithNewAlphabetKeys,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ func (gp *Processor) updateNotaryRoleInSidechain(ctx context.Context, newAlphabe
|
|||
err := gp.morphClient.UpdateNotaryList(ctx, updPrm)
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantUpdateListOfNotaryNodesInSideChain,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,6 @@ func (gp *Processor) updateFrostFSContractInMainnet(ctx context.Context, newAlph
|
|||
err := gp.frostfsClient.AlphabetUpdate(ctx, prm)
|
||||
if err != nil {
|
||||
gp.log.Error(ctx, logs.GovernanceCantUpdateListOfAlphabetNodesInFrostfsContract,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func (np *Processor) processNetmapCleanupTick(ctx context.Context, ev netmapClea
|
|||
})
|
||||
if err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCantIterateOnNetmapCleanerCache,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ func (np *Processor) processNewEpoch(ctx context.Context, ev netmapEvent.NewEpoc
|
|||
epochDuration, err := np.netmapClient.EpochDuration()
|
||||
if err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCantGetEpochDuration,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
} else {
|
||||
np.epochState.SetEpochDuration(epochDuration)
|
||||
}
|
||||
|
@ -28,19 +28,19 @@ func (np *Processor) processNewEpoch(ctx context.Context, ev netmapEvent.NewEpoc
|
|||
if err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCantGetTransactionHeight,
|
||||
zap.String("hash", ev.TxHash().StringLE()),
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
if err := np.epochTimer.ResetEpochTimer(h); err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCantResetEpochTimer,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
// get new netmap snapshot
|
||||
networkMap, err := np.netmapClient.NetMap()
|
||||
if err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCantGetNetmapSnapshotToPerformCleanup,
|
||||
zap.String("error", err.Error()))
|
||||
zap.Error(err))
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ func (np *Processor) processAddPeer(ctx context.Context, ev netmapEvent.AddPeer)
|
|||
err = np.nodeValidator.VerifyAndUpdate(&nodeInfo)
|
||||
if err != nil {
|
||||
np.log.Warn(ctx, logs.NetmapCouldNotVerifyAndUpdateInformationAboutNetworkMapCandidate,
|
||||
zap.String("error", err.Error()),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue