Skip to content

Commit 155f487

Browse files
authored
Merge pull request kubernetes-csi#2 from pohly/connection-logging
connection: replace glog with klog
2 parents 23d286e + e2d2c14 commit 155f487

File tree

5 files changed

+102
-39
lines changed

5 files changed

+102
-39
lines changed

Gopkg.lock

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connection/connection.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323
"strings"
2424
"time"
2525

26-
"github.com/golang/glog"
2726
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
2827
"google.golang.org/grpc"
28+
"k8s.io/klog"
2929
)
3030

3131
const (
@@ -102,7 +102,7 @@ func connect(address string, dialOptions []grpc.DialOption, connectOptions []Opt
102102
if haveConnected && !lostConnection {
103103
// We have detected a loss of connection for the first time. Decide what to do...
104104
// Record this once. TODO (?): log at regular time intervals.
105-
glog.Errorf("Lost connection to %s.", address)
105+
klog.Errorf("Lost connection to %s.", address)
106106
// Inform caller and let it decide? Default is to reconnect.
107107
if o.reconnect != nil {
108108
reconnect = o.reconnect()
@@ -124,7 +124,7 @@ func connect(address string, dialOptions []grpc.DialOption, connectOptions []Opt
124124
return nil, errors.New("OnConnectionLoss callback only supported for unix:// addresses")
125125
}
126126

127-
glog.Infof("Connecting to %s", address)
127+
klog.Infof("Connecting to %s", address)
128128

129129
// Connect in background.
130130
var conn *grpc.ClientConn
@@ -143,7 +143,7 @@ func connect(address string, dialOptions []grpc.DialOption, connectOptions []Opt
143143
for {
144144
select {
145145
case <-ticker.C:
146-
glog.Warningf("Still connecting to %s", address)
146+
klog.Warningf("Still connecting to %s", address)
147147

148148
case <-ready:
149149
return conn, err
@@ -153,10 +153,10 @@ func connect(address string, dialOptions []grpc.DialOption, connectOptions []Opt
153153

154154
// LogGRPC is gPRC unary interceptor for logging of CSI messages at level 5. It removes any secrets from the message.
155155
func LogGRPC(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
156-
glog.V(5).Infof("GRPC call: %s", method)
157-
glog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req))
156+
klog.V(5).Infof("GRPC call: %s", method)
157+
klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req))
158158
err := invoker(ctx, method, req, reply, cc, opts...)
159-
glog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply))
160-
glog.V(5).Infof("GRPC error: %v", err)
159+
klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply))
160+
klog.V(5).Infof("GRPC error: %v", err)
161161
return err
162162
}

vendor/github.com/golang/glog/glog.go renamed to vendor/k8s.io/klog/klog.go

Lines changed: 73 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/golang/glog/glog_file.go renamed to vendor/k8s.io/klog/klog_file.go

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)