[#607] *: Use zap.Stringer() where possible

Semantic patch:
```
@@
var f expression
var t expression
var a expression
@@
 f(
    ...,
-    zap.String(t, a.String()),
+    zap.Stringer(t, a),
    ...,
)
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-08-14 14:08:18 +03:00 committed by Evgenii Stratonikov
parent a8de37c8a2
commit e604a3d749
5 changed files with 6 additions and 6 deletions

View file

@ -104,14 +104,14 @@ func serveGRPC(c *cfg) {
go func() { go func() {
defer func() { defer func() {
c.log.Info(logs.FrostFSNodeStopListeningGRPCEndpoint, c.log.Info(logs.FrostFSNodeStopListeningGRPCEndpoint,
zap.String("endpoint", lis.Addr().String()), zap.Stringer("endpoint", lis.Addr()),
) )
c.wg.Done() c.wg.Done()
}() }()
c.log.Info(logs.FrostFSNodeStartListeningGRPCEndpoint, c.log.Info(logs.FrostFSNodeStartListeningGRPCEndpoint,
zap.String("endpoint", lis.Addr().String()), zap.Stringer("endpoint", lis.Addr()),
) )
if err := srv.Serve(lis); err != nil { if err := srv.Serve(lis); err != nil {

View file

@ -45,7 +45,7 @@ func (np *Processor) processDeposit(deposit frostfsEvent.Deposit) bool {
val, ok := np.mintEmitCache.Get(receiver.String()) val, ok := np.mintEmitCache.Get(receiver.String())
if ok && val+np.mintEmitThreshold >= curEpoch { if ok && val+np.mintEmitThreshold >= curEpoch {
np.log.Warn(logs.FrostFSDoubleMintEmissionDeclined, np.log.Warn(logs.FrostFSDoubleMintEmissionDeclined,
zap.String("receiver", receiver.String()), zap.Stringer("receiver", receiver),
zap.Uint64("last_emission", val), zap.Uint64("last_emission", val),
zap.Uint64("current_epoch", curEpoch)) zap.Uint64("current_epoch", curEpoch))

View file

@ -55,7 +55,7 @@ func (e *StorageEngine) RemoveDuplicates(ctx context.Context, prm RemoveDuplicat
// This is not currently the case, because `FreeSpace` metric used by weight sorting is always 0. // This is not currently the case, because `FreeSpace` metric used by weight sorting is always 0.
// However we could change weights in future and easily forget this function. // However we could change weights in future and easily forget this function.
for _, sh := range e.shards { for _, sh := range e.shards {
e.log.Debug(logs.EngineStartedDuplicatesRemovalRoutine, zap.String("shard_id", sh.ID().String())) e.log.Debug(logs.EngineStartedDuplicatesRemovalRoutine, zap.Stringer("shard_id", sh.ID()))
ch := make(chan oid.Address) ch := make(chan oid.Address)
errG, ctx := errgroup.WithContext(ctx) errG, ctx := errgroup.WithContext(ctx)

View file

@ -49,7 +49,7 @@ func (s *Shard) UpdateID() (err error) {
} }
} }
s.log = &logger.Logger{Logger: s.log.With(zap.String("shard_id", s.info.ID.String()))} s.log = &logger.Logger{Logger: s.log.With(zap.Stringer("shard_id", s.info.ID))}
s.metaBase.SetLogger(s.log) s.metaBase.SetLogger(s.log)
s.blobStor.SetLogger(s.log) s.blobStor.SetLogger(s.log)
if s.hasWriteCache() { if s.hasWriteCache() {

View file

@ -89,7 +89,7 @@ func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op
if !basicACL.AllowedBearerRules(op) { if !basicACL.AllowedBearerRules(op) {
s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL, s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL,
zap.String("cid", cid.EncodeToString()), zap.String("cid", cid.EncodeToString()),
zap.String("op", op.String()), zap.Stringer("op", op),
) )
} else { } else {
useBearer = true useBearer = true