From f6c7b339a6b7592aa83abe253a40825fcb7d3e39 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Wed, 22 May 2013 11:42:04 -0700 Subject: [PATCH] undo CL 9658043 / ac7877558dce MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The original code was correct. The count returned must be the length of the input slice, not the length of the formatted message. ««« original CL description 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 »»» R=golang-dev, iant CC=golang-dev https://golang.org/cl/9644044 --- src/pkg/log/syslog/syslog.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pkg/log/syslog/syslog.go b/src/pkg/log/syslog/syslog.go index 3d7ab6febd..8bdd9825e1 100644 --- a/src/pkg/log/syslog/syslog.go +++ b/src/pkg/log/syslog/syslog.go @@ -258,9 +258,10 @@ func (w *Writer) write(p Priority, msg string) (int, error) { } timestamp := time.Now().Format(time.RFC3339) - return fmt.Fprintf(w.conn, "<%d>%s %s %s[%d]: %s%s", + fmt.Fprintf(w.conn, "<%d>%s %s %s[%d]: %s%s", p, timestamp, w.hostname, w.tag, os.Getpid(), msg, nl) + return len(msg), nil } // NewLogger creates a log.Logger whose output is written to -- 2.48.1