fix use of hclog logger (#7264)

This commit is contained in:
R.B. Boyer 2020-02-12 09:37:16 -06:00 committed by GitHub
parent 3a15fb9dde
commit 80b1165976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -68,8 +68,7 @@ func (s *Server) listen(listener net.Listener) {
free, err := s.rpcConnLimiter.Accept(conn) free, err := s.rpcConnLimiter.Accept(conn)
if err != nil { if err != nil {
s.rpcLogger().Error("rejecting RPC conn from %s"+ s.rpcLogger().Error("rejecting RPC conn from because rpc_max_conns_per_client exceeded", "conn", logConn(conn))
" rpc_max_conns_per_client exceeded", conn.RemoteAddr().String())
conn.Close() conn.Close()
continue continue
} }
@ -138,7 +137,7 @@ func (s *Server) handleConn(conn net.Conn, isTLS bool) {
case pool.RPCTLS: case pool.RPCTLS:
// Don't allow malicious client to create TLS-in-TLS for ever. // Don't allow malicious client to create TLS-in-TLS for ever.
if isTLS { if isTLS {
s.rpcLogger().Error("TLS connection attempting to establish inner TLS connection %s", logConn(conn)) s.rpcLogger().Error("TLS connection attempting to establish inner TLS connection", "conn", logConn(conn))
conn.Close() conn.Close()
return return
} }
@ -154,7 +153,7 @@ func (s *Server) handleConn(conn net.Conn, isTLS bool) {
case pool.RPCTLSInsecure: case pool.RPCTLSInsecure:
// Don't allow malicious client to create TLS-in-TLS for ever. // Don't allow malicious client to create TLS-in-TLS for ever.
if isTLS { if isTLS {
s.rpcLogger().Error("TLS connection attempting to establish inner TLS connection %s", logConn(conn)) s.rpcLogger().Error("TLS connection attempting to establish inner TLS connection", "conn", logConn(conn))
conn.Close() conn.Close()
return return
} }

View File

@ -205,7 +205,7 @@ func (s *Service) Dial(ctx context.Context, resolver Resolver) (net.Conn, error)
tlsConn.Close() tlsConn.Close()
return nil, err return nil, err
} }
s.logger.Debug("successfully connected to service instance", addr, s.logger.Debug("successfully connected to service instance",
"address", addr, "address", addr,
"identity", certURI.URI(), "identity", certURI.URI(),
) )

View File

@ -40,7 +40,7 @@ func New(logger hclog.Logger, r *raft.Raft) (*Snapshot, error) {
} }
defer func() { defer func() {
if err := snap.Close(); err != nil { if err := snap.Close(); err != nil {
logger.Error("Failed to close Raft snapshot: %v", err) logger.Error("Failed to close Raft snapshot", "error", err)
} }
}() }()