[#240] logs: Move log messages to constants

Drop duplicate entities.
Format entities.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-04-12 17:35:10 +03:00 committed by fyrchik
parent d29b13454f
commit 0e31c12e63
149 changed files with 1481 additions and 687 deletions

View file

@ -1,6 +1,7 @@
package netmap
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/audit"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/settlement"
@ -16,7 +17,7 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
epochDuration, err := np.netmapClient.EpochDuration()
if err != nil {
np.log.Warn("can't get epoch duration",
np.log.Warn(logs.NetmapCantGetEpochDuration,
zap.String("error", err.Error()))
} else {
np.epochState.SetEpochDuration(epochDuration)
@ -26,20 +27,20 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
h, err := np.netmapClient.Morph().TxHeight(ev.TxHash())
if err != nil {
np.log.Warn("can't get transaction height",
np.log.Warn(logs.NetmapCantGetTransactionHeight,
zap.String("hash", ev.TxHash().StringLE()),
zap.String("error", err.Error()))
}
if err := np.epochTimer.ResetEpochTimer(h); err != nil {
np.log.Warn("can't reset epoch timer",
np.log.Warn(logs.NetmapCantResetEpochTimer,
zap.String("error", err.Error()))
}
// get new netmap snapshot
networkMap, err := np.netmapClient.NetMap()
if err != nil {
np.log.Warn("can't get netmap snapshot to perform cleanup",
np.log.Warn(logs.NetmapCantGetNetmapSnapshotToPerformCleanup,
zap.String("error", err.Error()))
return
@ -54,7 +55,7 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
err = np.containerWrp.StartEstimation(prm)
if err != nil {
np.log.Warn("can't start container size estimation",
np.log.Warn(logs.NetmapCantStartContainerSizeEstimation,
zap.Uint64("epoch", epoch),
zap.String("error", err.Error()))
}
@ -71,15 +72,15 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
// Process new epoch tick by invoking new epoch method in network map contract.
func (np *Processor) processNewEpochTick() {
if !np.alphabetState.IsAlphabet() {
np.log.Info("non alphabet mode, ignore new epoch tick")
np.log.Info(logs.NetmapNonAlphabetModeIgnoreNewEpochTick)
return
}
nextEpoch := np.epochState.EpochCounter() + 1
np.log.Debug("next epoch", zap.Uint64("value", nextEpoch))
np.log.Debug(logs.NetmapNextEpoch, zap.Uint64("value", nextEpoch))
err := np.netmapClient.NewEpoch(nextEpoch)
if err != nil {
np.log.Error("can't invoke netmap.NewEpoch", zap.Error(err))
np.log.Error(logs.NetmapCantInvokeNetmapNewEpoch, zap.Error(err))
}
}