From 3b3d392540e64631aa5e15533ef4508fcc93dee5 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Fri, 8 Sep 2017 14:42:30 -0700 Subject: [PATCH] *: use grpclog.LoggerV2 Signed-off-by: Gyu-Ho Lee --- etcdctl/ctlv3/command/global.go | 4 ++-- tools/benchmark/cmd/util.go | 4 ++-- tools/functional-tester/etcd-tester/stresser.go | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/etcdctl/ctlv3/command/global.go b/etcdctl/ctlv3/command/global.go index b4cf18a90..eeef3ddb3 100644 --- a/etcdctl/ctlv3/command/global.go +++ b/etcdctl/ctlv3/command/global.go @@ -20,7 +20,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "os" "strings" "time" @@ -31,6 +30,7 @@ import ( "github.com/coreos/etcd/pkg/srv" "github.com/coreos/etcd/pkg/transport" "github.com/spf13/cobra" + "google.golang.org/grpc/grpclog" ) // GlobalFlags are flags that defined globally @@ -97,7 +97,7 @@ func mustClientFromCmd(cmd *cobra.Command) *clientv3.Client { ExitWithError(ExitError, derr) } if debug { - clientv3.SetLogger(log.New(os.Stderr, "grpc: ", 0)) + clientv3.SetLogger(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr)) } endpoints, err := endpointsFromCmd(cmd) diff --git a/tools/benchmark/cmd/util.go b/tools/benchmark/cmd/util.go index 544dceb29..c93fdbed5 100644 --- a/tools/benchmark/cmd/util.go +++ b/tools/benchmark/cmd/util.go @@ -18,12 +18,12 @@ import ( "context" "crypto/rand" "fmt" - "log" "os" "strings" "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/pkg/report" + "google.golang.org/grpc/grpclog" ) var ( @@ -98,7 +98,7 @@ func mustCreateConn() *clientv3.Client { return mustCreateConn() } - clientv3.SetLogger(log.New(os.Stderr, "grpc", 0)) + clientv3.SetLogger(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr)) if err != nil { fmt.Fprintf(os.Stderr, "dial error: %v\n", err) diff --git a/tools/functional-tester/etcd-tester/stresser.go b/tools/functional-tester/etcd-tester/stresser.go index 30e8d47d7..4c5cdcef6 100644 --- a/tools/functional-tester/etcd-tester/stresser.go +++ b/tools/functional-tester/etcd-tester/stresser.go @@ -16,6 +16,7 @@ package main import ( "fmt" + "os" "strings" "sync" "time" @@ -24,7 +25,7 @@ import ( "google.golang.org/grpc/grpclog" ) -func init() { grpclog.SetLogger(plog) } +func init() { grpclog.SetLoggerV2(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr)) } type Stresser interface { // Stress starts to stress the etcd cluster