diff options
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 |