From 2b46f300ca67a79af339a6da3aa9eee2efa280de Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sat, 8 Oct 2016 14:39:27 +0100 Subject: [PATCH] trace: Include debug messages in the traces We don't want to write debug messages to the log, but having them in traces is always useful. The traces are volatile and self-cleaning so the additional volume should not cause any problems, and helps troubleshooting. While at it, fix the depth constant when logging. --- internal/trace/trace.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/trace/trace.go b/internal/trace/trace.go index fa4130f..d96d9c5 100644 --- a/internal/trace/trace.go +++ b/internal/trace/trace.go @@ -25,16 +25,17 @@ func (t *Trace) Printf(format string, a ...interface{}) { if glog.V(0) { msg := fmt.Sprintf("%s %s: %s", t.family, t.title, quote(fmt.Sprintf(format, a...))) - glog.InfoDepth(2, msg) + glog.InfoDepth(1, msg) } } func (t *Trace) Debugf(format string, a ...interface{}) { + t.t.LazyPrintf(format, a...) + if glog.V(2) { - t.t.LazyPrintf(format, a...) msg := fmt.Sprintf("%s %s: %s", t.family, t.title, quote(fmt.Sprintf(format, a...))) - glog.InfoDepth(2, msg) + glog.InfoDepth(1, msg) } }