Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(26)

Delta Between Two Patch Sets: src/pkg/log/syslog/syslog_unix.go

Issue 6782140: code review 6782140: log/syslog: retry once if write fails (Closed)
Left Patch Set: diff -r 6e0e4077f488 https://code.google.com/p/go Created 12 years, 3 months ago
Right Patch Set: diff -r a9211b512258 http://code.google.com/p/go Created 12 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/log/syslog/syslog_test.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build !windows,!plan9 5 // +build !windows,!plan9
6 6
7 package syslog 7 package syslog
8 8
9 import ( 9 import (
10 "errors" 10 "errors"
11 "net" 11 "net"
12 ) 12 )
13 13
14 // unixSyslog opens a connection to the syslog daemon running on the 14 // unixSyslog opens a connection to the syslog daemon running on the
15 // local machine using a Unix domain socket. 15 // local machine using a Unix domain socket.
16 16
17 func unixSyslog() (conn serverConn, err error) { 17 func unixSyslog() (conn net.Conn, err error) {
18 logTypes := []string{"unixgram", "unix"} 18 logTypes := []string{"unixgram", "unix"}
19 logPaths := []string{"/dev/log", "/var/run/syslog"} 19 logPaths := []string{"/dev/log", "/var/run/syslog"}
20 var raddr string
21 for _, network := range logTypes { 20 for _, network := range logTypes {
22 for _, path := range logPaths { 21 for _, path := range logPaths {
23 » » » raddr = path 22 » » » conn, err := net.Dial(network, path)
24 » » » conn, err := net.Dial(network, raddr)
25 if err != nil { 23 if err != nil {
26 continue 24 continue
27 } else { 25 } else {
28 » » » » return netConn{conn}, nil 26 » » » » return conn, nil
29 } 27 }
30 } 28 }
31 } 29 }
32 return nil, errors.New("Unix syslog delivery error") 30 return nil, errors.New("Unix syslog delivery error")
33 } 31 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b