[#240] logs: Factor out common service log messages

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-04-13 15:51:36 +03:00 committed by fyrchik
parent 0e31c12e63
commit cffcc7745e
15 changed files with 53 additions and 64 deletions

View file

@ -11,7 +11,7 @@ import (
func (bp *Processor) handleLock(ev event.Event) {
lock := ev.(balanceEvent.Lock)
bp.log.Info(logs.BalanceNotification,
bp.log.Info(logs.Notification,
zap.String("type", "lock"),
zap.String("value", hex.EncodeToString(lock.ID())))

View file

@ -14,7 +14,7 @@ func (cp *Processor) handlePut(ev event.Event) {
put := ev.(putEvent)
id := sha256.Sum256(put.Container())
cp.log.Info(logs.ContainerNotification,
cp.log.Info(logs.Notification,
zap.String("type", "container put"),
zap.String("id", base58.Encode(id[:])))
@ -30,7 +30,7 @@ func (cp *Processor) handlePut(ev event.Event) {
func (cp *Processor) handleDelete(ev event.Event) {
del := ev.(containerEvent.Delete)
cp.log.Info(logs.ContainerNotification,
cp.log.Info(logs.Notification,
zap.String("type", "container delete"),
zap.String("id", base58.Encode(del.ContainerID())))
@ -47,7 +47,7 @@ func (cp *Processor) handleDelete(ev event.Event) {
func (cp *Processor) handleSetEACL(ev event.Event) {
e := ev.(containerEvent.SetEACL)
cp.log.Info(logs.ContainerNotification,
cp.log.Info(logs.Notification,
zap.String("type", "set EACL"),
)

View file

@ -12,7 +12,7 @@ import (
func (np *Processor) handleDeposit(ev event.Event) {
deposit := ev.(frostfsEvent.Deposit)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "deposit"),
zap.String("id", hex.EncodeToString(slice.CopyReverse(deposit.ID()))))
@ -28,7 +28,7 @@ func (np *Processor) handleDeposit(ev event.Event) {
func (np *Processor) handleWithdraw(ev event.Event) {
withdraw := ev.(frostfsEvent.Withdraw)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "withdraw"),
zap.String("id", hex.EncodeToString(slice.CopyReverse(withdraw.ID()))))
@ -44,7 +44,7 @@ func (np *Processor) handleWithdraw(ev event.Event) {
func (np *Processor) handleCheque(ev event.Event) {
cheque := ev.(frostfsEvent.Cheque)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "cheque"),
zap.String("id", hex.EncodeToString(cheque.ID())))
@ -60,7 +60,7 @@ func (np *Processor) handleCheque(ev event.Event) {
func (np *Processor) handleConfig(ev event.Event) {
cfg := ev.(frostfsEvent.Config)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "set config"),
zap.String("key", hex.EncodeToString(cfg.Key())),
zap.String("value", hex.EncodeToString(cfg.Value())))
@ -77,7 +77,7 @@ func (np *Processor) handleConfig(ev event.Event) {
func (np *Processor) handleBind(ev event.Event) {
e := ev.(frostfsEvent.Bind)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "bind"),
)
@ -93,7 +93,7 @@ func (np *Processor) handleBind(ev event.Event) {
func (np *Processor) handleUnbind(ev event.Event) {
e := ev.(frostfsEvent.Unbind)
np.log.Info(logs.FrostFSNotification,
np.log.Info(logs.Notification,
zap.String("type", "unbind"),
)

View file

@ -27,7 +27,7 @@ func (np *Processor) HandleNewEpochTick(ev event.Event) {
func (np *Processor) handleNewEpoch(ev event.Event) {
epochEvent := ev.(netmapEvent.NewEpoch)
np.log.Info(logs.NetmapNotification,
np.log.Info(logs.Notification,
zap.String("type", "new epoch"),
zap.Uint64("value", epochEvent.EpochNumber()))
@ -46,7 +46,7 @@ func (np *Processor) handleNewEpoch(ev event.Event) {
func (np *Processor) handleAddPeer(ev event.Event) {
newPeer := ev.(netmapEvent.AddPeer)
np.log.Info(logs.NetmapNotification,
np.log.Info(logs.Notification,
zap.String("type", "add peer"),
)
@ -64,7 +64,7 @@ func (np *Processor) handleAddPeer(ev event.Event) {
func (np *Processor) handleUpdateState(ev event.Event) {
updPeer := ev.(netmapEvent.UpdatePeer)
np.log.Info(logs.NetmapNotification,
np.log.Info(logs.Notification,
zap.String("type", "update peer state"),
zap.String("key", hex.EncodeToString(updPeer.PublicKey().Bytes())))
@ -105,7 +105,7 @@ func (np *Processor) handleCleanupTick(ev event.Event) {
func (np *Processor) handleRemoveNode(ev event.Event) {
removeNode := ev.(subnetevents.RemoveNode)
np.log.Info(logs.NetmapNotification,
np.log.Info(logs.Notification,
zap.String("type", "remove node from subnet"),
zap.String("subnetID", hex.EncodeToString(removeNode.SubnetworkID())),
zap.String("key", hex.EncodeToString(removeNode.Node())),

View file

@ -14,7 +14,7 @@ func (rp *Processor) handlePutReputation(ev event.Event) {
peerID := put.PeerID()
// FIXME: #1147 do not use `ToV2` method outside frostfs-api-go library
rp.log.Info(logs.ReputationNotification,
rp.log.Info(logs.Notification,
zap.String("type", "reputation put"),
zap.String("peer_id", hex.EncodeToString(peerID.PublicKey())))