mirror of https://github.com/golang/go.git
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
This commit is contained in:
parent
dbee8ad0f9
commit
e17a6d4b9d
|
|
@ -258,9 +258,15 @@ func (w *Writer) write(p Priority, msg string) (int, error) {
|
|||
}
|
||||
|
||||
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,
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue