summaryrefslogtreecommitdiff
path: root/libgo/go/log
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-14 00:05:42 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-14 00:05:42 +0000
commitccea2b367771831e9877ec31e0656d153818bf3f (patch)
treee183ae81a1f48a02945cb6de463a70c5be1b06f6 /libgo/go/log
parentfd961cec64a5807cd6375d5c4042bca4256c5fda (diff)
downloadgcc-ccea2b367771831e9877ec31e0656d153818bf3f.tar.gz
libgo: update to Go 1.8 release candidate 1
Compiler changes: * Change map assignment to use mapassign and assign value directly. * Change string iteration to use decoderune, faster for ASCII strings. * Change makeslice to take int, and use makeslice64 for larger values. * Add new noverflow field to hmap struct used for maps. Unresolved problems, to be fixed later: * Commented out test in go/types/sizes_test.go that doesn't compile. * Commented out reflect.TestStructOf test for padding after zero-sized field. Reviewed-on: https://go-review.googlesource.com/35231 gotools/: Updates for Go 1.8rc1. * Makefile.am (go_cmd_go_files): Add bug.go. (s-zdefaultcc): Write defaultPkgConfig. * Makefile.in: Rebuild. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/log')
-rw-r--r--libgo/go/log/log.go2
-rw-r--r--libgo/go/log/syslog/doc.go2
-rw-r--r--libgo/go/log/syslog/example_test.go24
-rw-r--r--libgo/go/log/syslog/syslog.go2
-rw-r--r--libgo/go/log/syslog/syslog_test.go5
5 files changed, 33 insertions, 2 deletions
diff --git a/libgo/go/log/log.go b/libgo/go/log/log.go
index 26cdb532dfc..58b8788be4a 100644
--- a/libgo/go/log/log.go
+++ b/libgo/go/log/log.go
@@ -8,6 +8,8 @@
// Panic[f|ln], which are easier to use than creating a Logger manually.
// That logger writes to standard error and prints the date and time
// of each logged message.
+// Every log message is output on a separate line: if the message being
+// printed does not end in a newline, the logger will add one.
// The Fatal functions call os.Exit(1) after writing the log message.
// The Panic functions call panic after writing the log message.
package log
diff --git a/libgo/go/log/syslog/doc.go b/libgo/go/log/syslog/doc.go
index dfcc2dde34f..54585232498 100644
--- a/libgo/go/log/syslog/doc.go
+++ b/libgo/go/log/syslog/doc.go
@@ -10,7 +10,7 @@
// the syslog client will attempt to reconnect to the server
// and write again.
//
-// The syslog package is frozen and not accepting new features.
+// The syslog package is frozen and is not accepting new features.
// Some external packages provide more functionality. See:
//
// https://godoc.org/?q=syslog
diff --git a/libgo/go/log/syslog/example_test.go b/libgo/go/log/syslog/example_test.go
new file mode 100644
index 00000000000..0513b26da17
--- /dev/null
+++ b/libgo/go/log/syslog/example_test.go
@@ -0,0 +1,24 @@
+// Copyright 2016 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.
+
+// +build ignore
+// +build !windows,!nacl,!plan9
+
+package syslog_test
+
+import (
+ "fmt"
+ "log"
+ "log/syslog"
+)
+
+func ExampleDial() {
+ sysLog, err := syslog.Dial("tcp", "localhost:1234",
+ syslog.LOG_WARNING|syslog.LOG_DAEMON, "demotag")
+ if err != nil {
+ log.Fatal(err)
+ }
+ fmt.Fprintf(sysLog, "This is a daemon warning with demotag.")
+ sysLog.Emerg("And this is a daemon emergency with demotag.")
+}
diff --git a/libgo/go/log/syslog/syslog.go b/libgo/go/log/syslog/syslog.go
index 9e888dd1d9d..df9ffb8e331 100644
--- a/libgo/go/log/syslog/syslog.go
+++ b/libgo/go/log/syslog/syslog.go
@@ -112,6 +112,8 @@ func New(priority Priority, tag string) (*Writer, error) {
// writer sends a log message with the given facility, severity and
// tag.
// If network is empty, Dial will connect to the local syslog server.
+// Otherwise, see the documentation for net.Dial for valid values
+// of network and raddr.
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/libgo/go/log/syslog/syslog_test.go b/libgo/go/log/syslog/syslog_test.go
index 52363f9f7c2..1263be6d783 100644
--- a/libgo/go/log/syslog/syslog_test.go
+++ b/libgo/go/log/syslog/syslog_test.go
@@ -134,6 +134,7 @@ func startServer(n, la string, done chan<- string) (addr string, sock io.Closer,
}
func TestWithSimulated(t *testing.T) {
+ t.Parallel()
msg := "Test 123"
var transport []string
for _, n := range []string{"unix", "unixgram", "udp", "tcp"} {
@@ -262,6 +263,7 @@ func check(t *testing.T, in, out string) {
}
func TestWrite(t *testing.T) {
+ t.Parallel()
tests := []struct {
pri Priority
pre string
@@ -367,7 +369,8 @@ func TestConcurrentReconnect(t *testing.T) {
defer wg.Done()
w, err := Dial(net, addr, LOG_USER|LOG_ERR, "tag")
if err != nil {
- t.Fatalf("syslog.Dial() failed: %v", err)
+ t.Errorf("syslog.Dial() failed: %v", err)
+ return
}
defer w.Close()
for i := 0; i < M; i++ {