1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:10:24 -07:00

log/syslog: report errors from Fprintf

Thanks to chiparus for identifying this.

Fixes #5541.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9658043
This commit is contained in:
Rob Pike 2013-05-22 11:03:10 -07:00
parent 6289dccf8b
commit 4c2df76b7d

View File

@ -258,10 +258,9 @@ func (w *Writer) write(p Priority, msg string) (int, error) {
} }
timestamp := time.Now().Format(time.RFC3339) timestamp := time.Now().Format(time.RFC3339)
fmt.Fprintf(w.conn, "<%d>%s %s %s[%d]: %s%s", return fmt.Fprintf(w.conn, "<%d>%s %s %s[%d]: %s%s",
p, timestamp, w.hostname, p, timestamp, w.hostname,
w.tag, os.Getpid(), msg, nl) w.tag, os.Getpid(), msg, nl)
return len(msg), nil
} }
// NewLogger creates a log.Logger whose output is written to // NewLogger creates a log.Logger whose output is written to