Skip to content

Commit

Permalink
logging: add explicit log levels for debug info (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
tam7t authored Feb 2, 2022
1 parent 327e80a commit d203a13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ func Parse(in *MountParams) (*MountConfig, error) {
}

if out.AuthNodePublishSecret {
klog.InfoS("parsed auth", "auth", "nodePublishSecretRef", "pod", podInfo)
klog.V(3).InfoS("parsed auth", "auth", "nodePublishSecretRef", "pod", podInfo)
}
if out.AuthPodADC {
klog.InfoS("parsed auth", "auth", "pod-adc", "pod", podInfo)
klog.V(3).InfoS("parsed auth", "auth", "pod-adc", "pod", podInfo)
}
if out.AuthProviderADC {
klog.InfoS("parsed auth", "auth", "provider-adc", "pod", podInfo)
klog.V(3).InfoS("parsed auth", "auth", "provider-adc", "pod", podInfo)
}

if os.Getenv("DEBUG") == "true" {
Expand Down
8 changes: 4 additions & 4 deletions infra/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ func LogInterceptor() grpc.UnaryServerInterceptor {
start := time.Now()
deadline, _ := ctx.Deadline()
dd := time.Until(deadline).String()
if klog.V(5).Enabled() {
klog.V(5).InfoS("request", "method", info.FullMethod, "deadline", dd)
if klog.V(3).Enabled() {
klog.V(3).InfoS("request", "method", info.FullMethod, "deadline", dd)
}
resp, err := handler(ctx, req)
if klog.V(5).Enabled() {
if klog.V(2).Enabled() {
s, _ := status.FromError(err)
klog.V(5).InfoS("response", "method", info.FullMethod, "deadline", dd, "duration", time.Since(start).String(), "status.code", s.Code(), "status.message", s.Message())
klog.V(2).InfoS("response", "method", info.FullMethod, "deadline", dd, "duration", time.Since(start).String(), "status.code", s.Code(), "status.message", s.Message())
}
return resp, err
}
Expand Down

0 comments on commit d203a13

Please sign in to comment.