Merge pull request #2842 from nspcc-dev/stringer

*: use zap.Stringer instead of zap.String where it can be used
This commit is contained in:
Roman Khimov 2022-12-13 22:12:18 +07:00 committed by GitHub
commit 3e714a348e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -226,7 +226,7 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger) (*Bl
// Protocol configuration fixups/checks.
if cfg.InitialGASSupply <= 0 {
cfg.InitialGASSupply = fixedn.Fixed8(defaultInitialGAS)
log.Info("initial gas supply is not set or wrong, setting default value", zap.String("InitialGASSupply", cfg.InitialGASSupply.String()))
log.Info("initial gas supply is not set or wrong, setting default value", zap.Stringer("InitialGASSupply", cfg.InitialGASSupply))
}
if cfg.MemPoolSize <= 0 {
cfg.MemPoolSize = defaultMemPoolSize

View file

@ -1292,7 +1292,7 @@ func getRequestBlocksPayload(p Peer, currHeight uint32, lastRequestedHeight *ato
func (s *Server) handleMessage(peer Peer, msg *Message) error {
s.log.Debug("got msg",
zap.Stringer("addr", peer.RemoteAddr()),
zap.String("type", msg.Command.String()))
zap.Stringer("type", msg.Command))
start := time.Now()
defer func() { addCmdTimeMetric(msg.Command, time.Since(start)) }()

View file

@ -83,7 +83,7 @@ func (t *TCPTransport) Accept() {
if errors.Is(err, net.ErrClosed) && quit {
break
}
t.log.Warn("TCP accept error", zap.String("address", l.Addr().String()), zap.Error(err))
t.log.Warn("TCP accept error", zap.Stringer("address", l.Addr()), zap.Error(err))
continue
}
p := NewTCPPeer(conn, "", t.server)

View file

@ -2640,14 +2640,14 @@ chloop:
if err != nil {
s.log.Error("failed to marshal notification",
zap.Error(err),
zap.String("type", resp.Event.String()))
zap.Stringer("type", resp.Event))
break subloop
}
msg, err = websocket.NewPreparedMessage(websocket.TextMessage, b)
if err != nil {
s.log.Error("failed to prepare notification message",
zap.Error(err),
zap.String("type", resp.Event.String()))
zap.Stringer("type", resp.Event))
break subloop
}
}