logger/glog: fix go vet issues

logging.printf triggered a format string warning. Silence it
by renaming the function.
This commit is contained in:
Felix Lange 2016-04-15 10:58:41 +02:00
parent 24cdac41f3
commit ebf3cf8f7d
2 changed files with 9 additions and 9 deletions

View File

@ -698,7 +698,7 @@ func (l *loggingT) printDepth(s severity, depth int, args ...interface{}) {
l.output(s, buf, file, line, false)
}
func (l *loggingT) printf(s severity, format string, args ...interface{}) {
func (l *loggingT) printfmt(s severity, format string, args ...interface{}) {
buf, file, line := l.header(s, 0)
fmt.Fprintf(buf, format, args...)
if buf.Bytes()[buf.Len()-1] != '\n' {
@ -1088,7 +1088,7 @@ func (v Verbose) Infoln(args ...interface{}) {
// See the documentation of V for usage.
func (v Verbose) Infof(format string, args ...interface{}) {
if v {
logging.printf(infoLog, format, args...)
logging.printfmt(infoLog, format, args...)
}
}
@ -1107,13 +1107,13 @@ func InfoDepth(depth int, args ...interface{}) {
// Infoln logs to the INFO log.
// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func Infoln(args ...interface{}) {
logging.println(infoLog, args...)
logging.print(infoLog, args...)
}
// Infof logs to the INFO log.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Infof(format string, args ...interface{}) {
logging.printf(infoLog, format, args...)
logging.printfmt(infoLog, format, args...)
}
// Warning logs to the WARNING and INFO logs.
@ -1137,7 +1137,7 @@ func Warningln(args ...interface{}) {
// Warningf logs to the WARNING and INFO logs.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Warningf(format string, args ...interface{}) {
logging.printf(warningLog, format, args...)
logging.printfmt(warningLog, format, args...)
}
// Error logs to the ERROR, WARNING, and INFO logs.
@ -1161,7 +1161,7 @@ func Errorln(args ...interface{}) {
// Errorf logs to the ERROR, WARNING, and INFO logs.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Errorf(format string, args ...interface{}) {
logging.printf(errorLog, format, args...)
logging.printfmt(errorLog, format, args...)
}
// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,
@ -1188,7 +1188,7 @@ func Fatalln(args ...interface{}) {
// including a stack trace of all running goroutines, then calls os.Exit(255).
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Fatalf(format string, args ...interface{}) {
logging.printf(fatalLog, format, args...)
logging.printfmt(fatalLog, format, args...)
}
// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks.
@ -1219,5 +1219,5 @@ func Exitln(args ...interface{}) {
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Exitf(format string, args ...interface{}) {
atomic.StoreUint32(&fatalNoStacks, 1)
logging.printf(fatalLog, format, args...)
logging.printfmt(fatalLog, format, args...)
}

View File

@ -300,7 +300,7 @@ func TestCompileModulePattern(t *testing.T) {
for _, test := range patternTests {
re, err := compileModulePattern(test.input)
if err != nil {
t.Fatalf("%s: %v", err)
t.Fatalf("%s: %v", test.input, err)
}
if re.String() != test.want {
t.Errorf("mismatch for %q: got %q, want %q", test.input, re.String(), test.want)