aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-16 23:26:19 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-16 23:26:19 -0400
commit424f293671b256bb5e253eea1cbb83519f4243f3 (patch)
treefd4edfb98433197d2a4f65cba7e17084781df0a6
parent45a4ee92ebe7a20ed78777e53b69c4a2f810c5d8 (diff)
downloadhaven-424f293671b256bb5e253eea1cbb83519f4243f3.tar.gz
haven-424f293671b256bb5e253eea1cbb83519f4243f3.tar.xz
haven-424f293671b256bb5e253eea1cbb83519f4243f3.zip
export logger so it can be disabled
-rw-r--r--nexgb/conn.go4
-rw-r--r--nexgb/xgb.go26
2 files changed, 15 insertions, 15 deletions
diff --git a/nexgb/conn.go b/nexgb/conn.go
index 9baf86c..62c31e9 100644
--- a/nexgb/conn.go
+++ b/nexgb/conn.go
@@ -33,8 +33,8 @@ func (c *Conn) connect(display string) error {
authName, authData, err := readAuthority(c.host, c.display)
noauth := false
if err != nil {
- logger.Printf("Could not get authority info: %v", err)
- logger.Println("Trying connection without authority info...")
+ Logger.Printf("Could not get authority info: %v", err)
+ Logger.Println("Trying connection without authority info...")
authName = ""
authData = []byte{}
noauth = true
diff --git a/nexgb/xgb.go b/nexgb/xgb.go
index ff4e461..dad0ed5 100644
--- a/nexgb/xgb.go
+++ b/nexgb/xgb.go
@@ -10,7 +10,7 @@ import (
)
var (
- logger = log.New(os.Stderr, "XGB: ", 0)
+ Logger = log.New(os.Stderr, "XGB: ", 0)
// ExtLock is a lock used whenever new extensions are initialized.
// It should not be used. It is exported for use in the extension
@@ -304,8 +304,8 @@ func (c *Conn) sendRequests() {
// writeBuffer is a convenience function for writing a byte slice to the wire.
func (c *Conn) writeBuffer(buf []byte) {
if _, err := c.conn.Write(buf); err != nil {
- logger.Printf("Write error: %s", err)
- logger.Fatal("A write error is unrecoverable. Exiting...")
+ Logger.Printf("Write error: %s", err)
+ Logger.Fatal("A write error is unrecoverable. Exiting...")
}
}
@@ -333,8 +333,8 @@ func (c *Conn) readResponses() {
err, event, seq = nil, nil, 0
if _, err := io.ReadFull(c.conn, buf); err != nil {
- logger.Printf("Read error: %s", err)
- logger.Fatal("A read error is unrecoverable. Exiting...")
+ Logger.Printf("Read error: %s", err)
+ Logger.Fatal("A read error is unrecoverable. Exiting...")
}
switch buf[0] {
@@ -343,7 +343,7 @@ func (c *Conn) readResponses() {
// generated) by looking it up by the error number.
newErrFun, ok := NewErrorFuncs[int(buf[1])]
if !ok {
- logger.Printf("BUG: Could not find error constructor function "+
+ Logger.Printf("BUG: Could not find error constructor function "+
"for error with number %d.", buf[1])
continue
}
@@ -362,8 +362,8 @@ func (c *Conn) readResponses() {
biggerBuf := make([]byte, byteCount)
copy(biggerBuf[:32], buf)
if _, err := io.ReadFull(c.conn, biggerBuf[32:]); err != nil {
- logger.Printf("Read error: %s", err)
- logger.Fatal("A read error is unrecoverable. Exiting...")
+ Logger.Printf("Read error: %s", err)
+ Logger.Fatal("A read error is unrecoverable. Exiting...")
}
replyBytes = biggerBuf
} else {
@@ -380,7 +380,7 @@ func (c *Conn) readResponses() {
evNum := int(buf[0] & 127)
newEventFun, ok := NewEventFuncs[evNum]
if !ok {
- logger.Printf("BUG: Could not find event construct function "+
+ Logger.Printf("BUG: Could not find event construct function "+
"for event with number %d.", evNum)
continue
}
@@ -429,7 +429,7 @@ func (c *Conn) readResponses() {
}
} else { // this is a reply
if cookie.replyChan == nil {
- logger.Printf("Reply with sequence id %d does not "+
+ Logger.Printf("Reply with sequence id %d does not "+
"have a cookie with a valid reply channel.", seq)
continue
} else {
@@ -442,12 +442,12 @@ func (c *Conn) readResponses() {
switch {
// Checked requests with replies
case cookie.replyChan != nil && cookie.errorChan != nil:
- logger.Printf("Found cookie with sequence id %d that is "+
+ Logger.Printf("Found cookie with sequence id %d that is "+
"expecting a reply but will never get it. Currently "+
"on sequence number %d", cookie.Sequence, seq)
// Unchecked requests with replies
case cookie.replyChan != nil && cookie.pingChan != nil:
- logger.Printf("Found cookie with sequence id %d that is "+
+ Logger.Printf("Found cookie with sequence id %d that is "+
"expecting a reply (and not an error) but will never "+
"get it. Currently on sequence number %d",
cookie.Sequence, seq)
@@ -470,7 +470,7 @@ func processEventOrError(everr eventOrError) (Event, Error) {
case Error:
return nil, ee
default:
- logger.Printf("Invalid event/error type: %T", everr)
+ Logger.Printf("Invalid event/error type: %T", everr)
return nil, nil
}
panic("unreachable")