FAQ
Reviewers: brainman,

Message:
Hello alex.brainman@gmail.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
log/syslog: build on Plan 9 and Windows

This allows logging errors to a local or remote syslog
daemon over any protocol except Unix domain sockets.

Please review this at http://codereview.appspot.com/6681044/

Affected files:
M src/pkg/log/syslog/syslog.go
A src/pkg/log/syslog/syslog_notunix.go
M src/pkg/log/syslog/syslog_test.go
R src/pkg/log/syslog/syslog_windows.go


Index: src/pkg/log/syslog/syslog.go
===================================================================
--- a/src/pkg/log/syslog/syslog.go
+++ b/src/pkg/log/syslog/syslog.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

-// +build !windows,!plan9
-
// Package syslog provides a simple interface to the system log service. It
// can send messages to the syslog daemon using UNIX domain sockets, UDP,
or
// TCP connections.
Index: src/pkg/log/syslog/syslog_notunix.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/pkg/log/syslog/syslog_notunix.go
@@ -0,0 +1,25 @@
+// Copyright 2012 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 windows plan9
+
+package syslog
+
+import (
+ "errors"
+ "runtime"
+)
+
+// unixSyslog opens a connection to the syslog daemon running on the
+// local machine using a Unix domain socket.
+func unixSyslog() (conn serverConn, err error) {
+ var os string
+ switch runtime.GOOS {
+ case "windows":
+ os = "Windows"
+ case "plan9":
+ os = "Plan 9"
+ }
+ return nil, errors.New("syslog: unix domain sockets are not supported
on " + os)
+}
Index: src/pkg/log/syslog/syslog_test.go
===================================================================
--- a/src/pkg/log/syslog/syslog_test.go
+++ b/src/pkg/log/syslog/syslog_test.go
@@ -10,6 +10,7 @@
"io"
"log"
"net"
+ "runtime"
"testing"
"time"
)
@@ -49,6 +50,10 @@
}

func TestNew(t *testing.T) {
+ switch runtime.GOOS {
+ case "windows", "plan9":
+ return // Unix domain sockets are not supported.
+ }
if skipNetTest(t) {
return
}
@@ -61,6 +66,10 @@
}

func TestNewLogger(t *testing.T) {
+ switch runtime.GOOS {
+ case "windows", "plan9":
+ return // Unix domain sockets are not supported.
+ }
if skipNetTest(t) {
return
}
@@ -71,6 +80,10 @@
}

func TestDial(t *testing.T) {
+ switch runtime.GOOS {
+ case "windows", "plan9":
+ return // Unix domain sockets are not supported.
+ }
if skipNetTest(t) {
return
}
Index: src/pkg/log/syslog/syslog_windows.go
===================================================================
deleted file mode 100644
--- a/src/pkg/log/syslog/syslog_windows.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2012 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 syslog provides a simple interface to the system log service.
-package syslog
-
-// BUG(brainman): This package is not implemented on Windows yet.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 13, '12 at 3:20a
activeOct 15, '12 at 3:52a
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase