Merge pull request #2917 from dchen1107/cleanup

Make httplog more useful by using glog.*Depth.
This commit is contained in:
Daniel Smith 2014-12-12 16:44:10 -08:00
commit 3868417ec5

View File

@ -63,7 +63,7 @@ type passthroughLogger struct{}
// Addf logs info immediately.
func (passthroughLogger) Addf(format string, data ...interface{}) {
glog.Infof(format, data...)
glog.InfoDepth(1, fmt.Sprintf(format, data...))
}
// DefaultStacktracePred is the default implementation of StacktracePred.
@ -148,7 +148,9 @@ func (rl *respLogger) Addf(format string, data ...interface{}) {
// Log is intended to be called once at the end of your request handler, via defer
func (rl *respLogger) Log() {
latency := time.Since(rl.startTime)
glog.V(2).Infof("%s %s: (%v) %v%v%v", rl.req.Method, rl.req.RequestURI, latency, rl.status, rl.statusStack, rl.addedInfo)
if glog.V(2) {
glog.InfoDepth(1, fmt.Sprintf("%s %s: (%v) %v%v%v", rl.req.Method, rl.req.RequestURI, latency, rl.status, rl.statusStack, rl.addedInfo))
}
}
// Header implements http.ResponseWriter.