aboutsummaryrefslogtreecommitdiff
path: root/nexgb/conn.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-08 00:27:00 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-08 00:27:00 -0400
commit62b293c9374609afa344135693c33b9e808ceb72 (patch)
tree9a3839a7ecb31862073a83d210bd4406d014662d /nexgb/conn.go
parente256da00b1fdccc7508a4cc5b9e9a3b195d44203 (diff)
downloadhaven-62b293c9374609afa344135693c33b9e808ceb72.tar.gz
haven-62b293c9374609afa344135693c33b9e808ceb72.tar.xz
haven-62b293c9374609afa344135693c33b9e808ceb72.zip
use a custom logger so we don't stomp all over the global log configuration
Diffstat (limited to 'nexgb/conn.go')
-rw-r--r--nexgb/conn.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/nexgb/conn.go b/nexgb/conn.go
index 02396d4..af78be9 100644
--- a/nexgb/conn.go
+++ b/nexgb/conn.go
@@ -26,8 +26,8 @@ func (c *Conn) connect(display string) error {
authName, authData, err := readAuthority(c.host, c.display)
noauth := false
if err != nil {
- fmt.Fprintf(os.Stderr, "Could not get authority info: %v\n", err)
- fmt.Fprintf(os.Stderr, "Trying connection without authority info...\n")
+ logger.Printf("Could not get authority info: %v", err)
+ logger.Println("Trying connection without authority info...")
authName = ""
authData = []byte{}
noauth = true
@@ -63,8 +63,7 @@ func (c *Conn) connect(display string) error {
dataLen := Get16(head[6:])
if major != 11 || minor != 0 {
- return errors.New(fmt.Sprintf("x protocol version mismatch: %d.%d",
- major, minor))
+ return fmt.Errorf("x protocol version mismatch: %d.%d", major, minor)
}
buf = make([]byte, int(dataLen)*4+8, int(dataLen)*4+8)
@@ -75,8 +74,8 @@ func (c *Conn) connect(display string) error {
if code == 0 {
reason := buf[8 : 8+reasonLen]
- return errors.New(fmt.Sprintf("x protocol authentication refused: %s",
- string(reason)))
+ return fmt.Errorf("x protocol authentication refused: %s",
+ string(reason))
}
ReadSetupInfo(buf, &c.Setup)