]> Cypherpunks repositories - gostls13.git/commitdiff
log/syslog: fix documentation for NewLogger
authorRob Pike <r@golang.org>
Thu, 9 Feb 2012 03:40:56 +0000 (14:40 +1100)
committerRob Pike <r@golang.org>
Thu, 9 Feb 2012 03:40:56 +0000 (14:40 +1100)
Fixes #2798.

R=golang-dev, bradfitz, r, rsc, rsc
CC=golang-dev
https://golang.org/cl/5642071

doc/go1.html
doc/go1.tmpl
src/pkg/log/syslog/syslog.go
src/pkg/log/syslog/syslog_test.go

index 8b0b4745e36d6bd1fea44f023de10de86607827a..6d8f148eda32bc051387dd2846d8d8af94467f77 100644 (file)
@@ -931,8 +931,10 @@ No changes will be needed.
 <h3 id="encoding_binary">The encoding/binary package</h3>
 
 <p>
-In Go 1, the <code>binary.TotalSize</code> function is renamed
-<a href="/pkg/encoding/binary/#Size"><code>Size</code></a>.
+In Go 1, the <code>binary.TotalSize</code> function has been replaced by
+<a href="/pkg/encoding/binary/#Size"><code>Size</code></a>,
+which takes an <code>interface{}</code> argument rather than
+a <code>reflect.Value</code>.
 </p>
 
 <p>
@@ -1287,6 +1289,18 @@ and
 Running <code>go fix</code> will update almost all code affected by the change.
 </p>
 
+<h3 id="log_syslog">The log/syslog package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/log/syslog/#NewLogger"><code>syslog.NewLogger</code></a>
+function returns an error as well as a <code>log.Logger</code>.
+</p>
+
+<p>
+<em>Updating</em>:
+What little code is affected will be caught by the compiler and must be updated by hand.
+</p>
+
 <h3 id="mime">The mime package</h3>
 
 <p>
index d6803ed18939ffecaec385464544794e85188650..096df3c25dc1aeb84a3e12586ae999dbfdcd5684 100644 (file)
@@ -1192,6 +1192,18 @@ and
 Running <code>go fix</code> will update almost all code affected by the change.
 </p>
 
+<h3 id="log_syslog">The log/syslog package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/log/syslog/#NewLogger"><code>syslog.NewLogger</code></a>
+function returns an error as well as a <code>log.Logger</code>.
+</p>
+
+<p>
+<em>Updating</em>:
+What little code is affected will be caught by the compiler and must be updated by hand.
+</p>
+
 <h3 id="mime">The mime package</h3>
 
 <p>
index 700b983c759d1f9966bcf09a6ccb9db3acccfdac..3eb5353e9a9b8ae73854d883ac0f73787942267e 100644 (file)
@@ -155,14 +155,14 @@ func (n netConn) close() error {
        return n.conn.Close()
 }
 
-// NewLogger provides an object that implements the full log.Logger interface,
-// but sends messages to Syslog instead; flag is passed as is to Logger;
-// priority will be used for all messages sent using this interface.
-// All messages are logged with priority p.
-func NewLogger(p Priority, flag int) *log.Logger {
+// NewLogger creates a log.Logger whose output is written to
+// the system log service with the specified priority. The logFlag
+// argument is the flag set passed through to log.New to create
+// the Logger.
+func NewLogger(p Priority, logFlag int) (*log.Logger, error) {
        s, err := New(p, "")
        if err != nil {
-               return nil
+               return nil, err
        }
-       return log.New(s, "", flag)
+       return log.New(s, "", logFlag), nil
 }
index b9793e91abd712e729773474b26e8bfdc956046d..7f509b3666e81574aea51f5ba70b032e486326c1 100644 (file)
@@ -61,9 +61,9 @@ func TestNewLogger(t *testing.T) {
        if skipNetTest(t) {
                return
        }
-       f := NewLogger(LOG_INFO, 0)
+       f, err := NewLogger(LOG_INFO, 0)
        if f == nil {
-               t.Error("NewLogger() failed")
+               t.Error(err)
        }
 }