From 15aabb38591c6abaa1dccc62bb7c8fb32fae7b1b Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Fri, 4 Mar 2022 19:19:06 +0800 Subject: [PATCH] log --- pkg/grpc-etcdv3/getcdv3/register.go | 8 ++++---- pkg/grpc-etcdv3/getcdv3/resolver.go | 19 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pkg/grpc-etcdv3/getcdv3/register.go b/pkg/grpc-etcdv3/getcdv3/register.go index d1c7957bf..cc555f3b4 100644 --- a/pkg/grpc-etcdv3/getcdv3/register.go +++ b/pkg/grpc-etcdv3/getcdv3/register.go @@ -67,16 +67,16 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin if err != nil { return fmt.Errorf("keepalive failed, errmsg:%v, lease id:%d", err, resp.ID) } - log.Info("", "RegisterEtcd ok ") + //log.Info("", "RegisterEtcd ok ") go func() { for { select { - case v, ok := <-kresp: + case _, ok := <-kresp: if ok == true { - log.Debug("", "KeepAlive kresp ok", v, schema, etcdAddr, myHost, myPort, serviceName, ttl) + //log.Debug("", "KeepAlive kresp ok", v, schema, etcdAddr, myHost, myPort, serviceName, ttl) } else { - log.Error("", "KeepAlive kresp failed", schema, etcdAddr, myHost, myPort, serviceName, ttl) + //log.Error("", "KeepAlive kresp failed", schema, etcdAddr, myHost, myPort, serviceName, ttl) } } } diff --git a/pkg/grpc-etcdv3/getcdv3/resolver.go b/pkg/grpc-etcdv3/getcdv3/resolver.go index 45f47a717..1e57f8cdd 100644 --- a/pkg/grpc-etcdv3/getcdv3/resolver.go +++ b/pkg/grpc-etcdv3/getcdv3/resolver.go @@ -1,7 +1,6 @@ package getcdv3 import ( - "Open_IM/pkg/common/log" "context" "fmt" "go.etcd.io/etcd/clientv3" @@ -103,7 +102,7 @@ func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts re if err == nil { var addrList []resolver.Address for i := range resp.Kvs { - log.Debug("", "init addr: ", string(resp.Kvs[i].Value)) + //log.Debug("", "init addr: ", string(resp.Kvs[i].Value)) addrList = append(addrList, resolver.Address{Addr: string(resp.Kvs[i].Value)}) } r.cc.UpdateState(resolver.State{Addresses: addrList}) @@ -149,27 +148,27 @@ func (r *Resolver) watch(prefix string, addrList []resolver.Address) { if !exists(addrList, string(ev.Kv.Value)) { flag = 1 addrList = append(addrList, resolver.Address{Addr: string(ev.Kv.Value)}) - log.Debug("", "after add, new list: ", addrList) + //log.Debug("", "after add, new list: ", addrList) } case mvccpb.DELETE: - log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value)) + //log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value)) i := strings.LastIndexAny(string(ev.Kv.Key), "/") if i < 0 { return } t := string(ev.Kv.Key)[i+1:] - log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value), "addr:", t) + //log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value), "addr:", t) if s, ok := remove(addrList, t); ok { flag = 1 addrList = s - log.Debug("after remove, new list: ", addrList) + //log.Debug("after remove, new list: ", addrList) } } } if flag == 1 { r.cc.UpdateState(resolver.State{Addresses: addrList}) - log.Debug("update: ", addrList) + //log.Debug("update: ", addrList) } } } @@ -177,7 +176,7 @@ func (r *Resolver) watch(prefix string, addrList []resolver.Address) { func GetConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn { gEtcdCli, err := clientv3.New(clientv3.Config{Endpoints: strings.Split(etcdaddr, ",")}) if err != nil { - log.Error("clientv3.New failed", err.Error()) + //log.Error("clientv3.New failed", err.Error()) return nil } @@ -201,7 +200,7 @@ func GetConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn { } } else { gEtcdCli.Close() - log.Error("gEtcdCli.Get failed", err.Error()) + //log.Error("gEtcdCli.Get failed", err.Error()) return nil } gEtcdCli.Close() @@ -237,7 +236,7 @@ func GetConnPool(schema, etcdaddr, servicename string) (*ClientConn, error) { ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(1000*time.Millisecond)) c, err := p.Get(ctx) - log.Info("", "Get ", err) + //log.Info("", "Get ", err) return c, err }