Commit e17a6d4b authored by Rob Pike's avatar Rob Pike

log/syslog: report errors from write

Fixes #5541.
This time for sure.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9668043
parent dbee8ad0
...@@ -258,9 +258,15 @@ func (w *Writer) write(p Priority, msg string) (int, error) { ...@@ -258,9 +258,15 @@ 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", _, err := 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)
if err != nil {
return 0, err
}
// Note: return the length of the input, not the number of
// bytes printed by Fprintf, because this must behave like
// an io.Writer.
return len(msg), nil return len(msg), nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment