diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-10-10 12:58:27 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-10-10 12:58:27 +0200 |
| commit | b28d0ff4cf40adafe940842907e7c1d8451d704c (patch) | |
| tree | f82a14e867056541107972f0bae2d38472103689 | |
| parent | d02ef2313528a5163d1ed26719b6db31b682b452 (diff) | |
log: don't cache messages with verbosity>1
Infinite verbosity produces too much noise, so don't cache messages with verbosity>1.
Need something better later, e.g. ability to view messages for different verbosity levels.
| -rw-r--r-- | log/log.go | 2 | ||||
| -rw-r--r-- | log/log_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/log/log.go b/log/log.go index 9fff33497..b17fb13e0 100644 --- a/log/log.go +++ b/log/log.go @@ -69,7 +69,7 @@ func DisableLog() { func Logf(v int, msg string, args ...interface{}) { mu.Lock() doLog := v <= *flagV && (v < 0 || !disabled) - if cacheEntries != nil { + if cacheEntries != nil && v <= 1 { cacheMem -= len(cacheEntries[cachePos]) if cacheMem < 0 { panic("log cache size underflow") diff --git a/log/log_test.go b/log/log_test.go index d179f0b87..cb40aceab 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -23,7 +23,7 @@ func TestCaching(t *testing.T) { EnableLogCaching(4, 20) prependTime = false for _, test := range tests { - Logf(1000, test.str) + Logf(1, test.str) out := CachedLogOutput() if out != test.want { t.Fatalf("wrote: %v\nwant: %v\ngot: %v", test.str, test.want, out) |
