diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
commit | 8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1 (patch) | |
tree | 4449f2036cccf162e8417cc5841a35815b3e7ac5 /src/pkg/log | |
parent | c8bf49ef8a92e2337b69c14b9b88396efe498600 (diff) | |
download | golang-upstream/1.3.tar.gz |
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'src/pkg/log')
-rw-r--r-- | src/pkg/log/example_test.go | 21 | ||||
-rw-r--r-- | src/pkg/log/syslog/syslog.go | 5 | ||||
-rw-r--r-- | src/pkg/log/syslog/syslog_test.go | 2 | ||||
-rw-r--r-- | src/pkg/log/syslog/syslog_unix.go | 2 |
4 files changed, 26 insertions, 4 deletions
diff --git a/src/pkg/log/example_test.go b/src/pkg/log/example_test.go new file mode 100644 index 000000000..74385a3a0 --- /dev/null +++ b/src/pkg/log/example_test.go @@ -0,0 +1,21 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package log_test + +import ( + "bytes" + "fmt" + "log" +) + +func ExampleLogger() { + var buf bytes.Buffer + logger := log.New(&buf, "logger: ", log.Lshortfile) + logger.Print("Hello, log file!") + + fmt.Print(&buf) + // Output: + // logger: example_test.go:16: Hello, log file! +} diff --git a/src/pkg/log/syslog/syslog.go b/src/pkg/log/syslog/syslog.go index 0cbfa9011..5e0959916 100644 --- a/src/pkg/log/syslog/syslog.go +++ b/src/pkg/log/syslog/syslog.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9 +// +build !windows,!nacl,!plan9 // Package syslog provides a simple interface to the system log // service. It can send messages to the syslog daemon using UNIX @@ -115,9 +115,10 @@ func New(priority Priority, tag string) (w *Writer, err error) { } // Dial establishes a connection to a log daemon by connecting to -// address raddr on the network net. Each write to the returned +// address raddr on the specified network. Each write to the returned // writer sends a log message with the given facility, severity and // tag. +// If network is empty, Dial will connect to the local syslog server. func Dial(network, raddr string, priority Priority, tag string) (*Writer, error) { if priority < 0 || priority > LOG_LOCAL7|LOG_DEBUG { return nil, errors.New("log/syslog: invalid priority") diff --git a/src/pkg/log/syslog/syslog_test.go b/src/pkg/log/syslog/syslog_test.go index 760a5c7d1..24a460f6d 100644 --- a/src/pkg/log/syslog/syslog_test.go +++ b/src/pkg/log/syslog/syslog_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9 +// +build !windows,!nacl,!plan9 package syslog diff --git a/src/pkg/log/syslog/syslog_unix.go b/src/pkg/log/syslog/syslog_unix.go index 28a294af9..f6d2f1b7a 100644 --- a/src/pkg/log/syslog/syslog_unix.go +++ b/src/pkg/log/syslog/syslog_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9 +// +build !windows,!nacl,!plan9 package syslog |