Properly fix formatting. Bleh bleh bleh.

This commit is contained in:
Alex Bramley 2010-12-20 22:14:22 +00:00
parent 1d587cd3fc
commit 2a3ff18d73
1 changed files with 3 additions and 5 deletions

View File

@ -44,9 +44,7 @@ type Conn struct {
Flood bool Flood bool
// Function which returns a *time.Time for use as a timestamp // Function which returns a *time.Time for use as a timestamp
// Format for *time.Time when outputting timestamps
Timestamp func() *time.Time Timestamp func() *time.Time
Format string
// Enable debugging? Set format for timestamps on debug output. // Enable debugging? Set format for timestamps on debug output.
Debug bool Debug bool
@ -74,7 +72,7 @@ func New(nick, user, name string) *Conn {
conn.SSLConfig = nil conn.SSLConfig = nil
conn.Me = conn.NewNick(nick, user, name, "") conn.Me = conn.NewNick(nick, user, name, "")
conn.Timestamp = time.LocalTime conn.Timestamp = time.LocalTime
conn.Format = "15:04:05" conn.TSFormat = "15:04:05"
conn.setupEvents() conn.setupEvents()
return conn return conn
} }
@ -196,7 +194,7 @@ func (conn *Conn) send() {
} }
conn.io.Flush() conn.io.Flush()
if conn.Debug { if conn.Debug {
fmt.Println(conn.Timestamp().Format(conn.Format) + " -> " + line) fmt.Println(conn.Timestamp().Format(conn.TSFormat) + " -> " + line)
} }
} }
} }
@ -213,7 +211,7 @@ func (conn *Conn) recv() {
} }
s = strings.Trim(s, "\r\n") s = strings.Trim(s, "\r\n")
if conn.Debug { if conn.Debug {
fmt.Println(t.Format(conn.Format) + " <- " + s) fmt.Println(t.Format(conn.TSFormat) + " <- " + s)
} }
line := &Line{Raw: s, Time: t} line := &Line{Raw: s, Time: t}