From f4331f8fc101e320bf2d57c57f13ce0814536831 Mon Sep 17 00:00:00 2001 From: shsjshentao <416435596@qq.com> Date: Fri, 7 Dec 2018 14:33:23 +0800 Subject: [PATCH] stderrthreshold is useless if logtostderr is set --- klog.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klog.go b/klog.go index 13bcc81a7..f085f8074 100644 --- a/klog.go +++ b/klog.go @@ -739,7 +739,9 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo } data := buf.Bytes() if l.toStderr { - os.Stderr.Write(data) + if s >= l.stderrThreshold.get() { + os.Stderr.Write(data) + } } else { if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() { os.Stderr.Write(data)