[#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

@ -5,6 +5,7 @@ import (
"strconv"
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
@ -83,7 +84,7 @@ func (exec *execCtx) formSplitInfo(ctx context.Context) bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not compose split info",
exec.log.Debug(logs.DeleteCouldNotComposeSplitInfo,
zap.String("error", err.Error()),
)
case err == nil:
@ -96,7 +97,7 @@ func (exec *execCtx) formSplitInfo(ctx context.Context) bool {
func (exec *execCtx) collectMembers(ctx context.Context) (ok bool) {
if exec.splitInfo == nil {
exec.log.Debug("no split info, object is PHY")
exec.log.Debug(logs.DeleteNoSplitInfoObjectIsPHY)
return true
}
@ -119,7 +120,7 @@ func (exec *execCtx) collectMembers(ctx context.Context) (ok bool) {
func (exec *execCtx) collectChain(ctx context.Context) bool {
var chain []oid.ID
exec.log.Debug("assembling chain...")
exec.log.Debug(logs.DeleteAssemblingChain)
for prev, withPrev := exec.splitInfo.LastPart(); withPrev; {
chain = append(chain, prev)
@ -131,7 +132,7 @@ func (exec *execCtx) collectChain(ctx context.Context) bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not get previous split element",
exec.log.Debug(logs.DeleteCouldNotGetPreviousSplitElement,
zap.Stringer("id", prev),
zap.String("error", err.Error()),
)
@ -154,7 +155,7 @@ func (exec *execCtx) collectChain(ctx context.Context) bool {
}
func (exec *execCtx) collectChildren(ctx context.Context) bool {
exec.log.Debug("collecting children...")
exec.log.Debug(logs.DeleteCollectingChildren)
children, err := exec.svc.header.children(ctx, exec)
@ -163,7 +164,7 @@ func (exec *execCtx) collectChildren(ctx context.Context) bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not collect object children",
exec.log.Debug(logs.DeleteCouldNotCollectObjectChildren,
zap.String("error", err.Error()),
)
@ -181,7 +182,7 @@ func (exec *execCtx) collectChildren(ctx context.Context) bool {
}
func (exec *execCtx) supplementBySplitID(ctx context.Context) bool {
exec.log.Debug("supplement by split ID")
exec.log.Debug(logs.DeleteSupplementBySplitID)
chain, err := exec.svc.searcher.splitMembers(ctx, exec)
@ -190,7 +191,7 @@ func (exec *execCtx) supplementBySplitID(ctx context.Context) bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not search for split chain members",
exec.log.Debug(logs.DeleteCouldNotSearchForSplitChainMembers,
zap.String("error", err.Error()),
)
@ -226,7 +227,7 @@ func (exec *execCtx) initTombstoneObject() bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not marshal tombstone structure",
exec.log.Debug(logs.DeleteCouldNotMarshalTombstoneStructure,
zap.String("error", err.Error()),
)
@ -265,7 +266,7 @@ func (exec *execCtx) saveTombstone(ctx context.Context) bool {
exec.status = statusUndefined
exec.err = err
exec.log.Debug("could not save the tombstone",
exec.log.Debug(logs.DeleteCouldNotSaveTheTombstone,
zap.String("error", err.Error()),
)