Unverified Commit 70bc7f68 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #67298 from sylr/logging-calltrace

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Log real file's name and line **What this PR does / why we need it**: Have correct location of emission in the logs **Release note**: pkg/kubectl/util/logs & staging/src/k8s.io/apiserver/pkg/util/logs use `glog.info(...)` but this function is not made to be wrapped because the underlying mechanism use a fixed call trace length to determine where the log has been emited. This results is having `logs.go:49` in the logs which is in the body of the wrapper function and thus useless. Instead use `glog.infoDepth(1, ...)` which tells the underlying mechanism to go back 1 more level in the call trace to determine where the log has been emitted.
parents f077d673 7e7b01fa
...@@ -38,7 +38,7 @@ type GlogWriter struct{} ...@@ -38,7 +38,7 @@ type GlogWriter struct{}
// Write implements the io.Writer interface. // Write implements the io.Writer interface.
func (writer GlogWriter) Write(data []byte) (n int, err error) { func (writer GlogWriter) Write(data []byte) (n int, err error) {
glog.Info(string(data)) glog.InfoDepth(1, string(data))
return len(data), nil return len(data), nil
} }
......
...@@ -47,7 +47,7 @@ type GlogWriter struct{} ...@@ -47,7 +47,7 @@ type GlogWriter struct{}
// Write implements the io.Writer interface. // Write implements the io.Writer interface.
func (writer GlogWriter) Write(data []byte) (n int, err error) { func (writer GlogWriter) Write(data []byte) (n int, err error) {
glog.Info(string(data)) glog.InfoDepth(1, string(data))
return len(data), nil return len(data), nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment