From ef5d9b5b69344cd4ea3d087c5070dd30f8c43459 Mon Sep 17 00:00:00 2001 From: maomao94 Date: Mon, 20 Oct 2025 12:05:21 +0800 Subject: [PATCH] refactor(rpc): improve gRPC client TLS config log formatting - Change TLS config check logs from string concatenation to placeholder formatting - Fix log output format during RPC client initialization - Adjust import location of credentials package to follow code conventions --- common/remote/rpc/grpc_client.go | 5 +++-- common/remote/rpc/rpc_client.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/remote/rpc/grpc_client.go b/common/remote/rpc/grpc_client.go index eba40c12..fe9f9f1a 100644 --- a/common/remote/rpc/grpc_client.go +++ b/common/remote/rpc/grpc_client.go @@ -22,7 +22,6 @@ import ( "crypto/x509" "encoding/json" "fmt" - "google.golang.org/grpc/credentials" "io" "log" "os" @@ -31,6 +30,8 @@ import ( "sync/atomic" "time" + "google.golang.org/grpc/credentials" + "github.com/pkg/errors" "github.com/nacos-group/nacos-sdk-go/v2/common/remote/rpc/rpc_request" @@ -172,7 +173,7 @@ func (c *GrpcClient) createNewConnection(serverInfo ServerInfo) (*grpc.ClientCon } func (c *GrpcClient) getEnvTLSConfig(config *constant.TLSConfig) { - logger.Infof("check tls config ", config) + logger.Infof("check tls config: %v", config) if config.Appointed == true { return diff --git a/common/remote/rpc/rpc_client.go b/common/remote/rpc/rpc_client.go index 515c639c..2c9cd38f 100644 --- a/common/remote/rpc/rpc_client.go +++ b/common/remote/rpc/rpc_client.go @@ -154,7 +154,7 @@ func CreateClient(ctx context.Context, clientName string, connectionType Connect cMux.Lock() defer cMux.Unlock() if _, ok := clientMap[clientName]; !ok { - logger.Infof("init rpc client for name ", clientName) + logger.Infof("init rpc client for name %s", clientName) var rpcClient IRpcClient if GRPC == connectionType { rpcClient = NewGrpcClient(ctx, clientName, nacosServer, tlsConfig)