implement Client.String()
This commit is contained in:
parent
aab3f30549
commit
383e1300bb
13
client.go
13
client.go
|
@ -187,6 +187,19 @@ func New(config Config) *Client {
|
|||
return c
|
||||
}
|
||||
|
||||
// String returns a brief description of the current client state.
|
||||
func (c *Client) String() string {
|
||||
var connected bool
|
||||
if c.conn != nil {
|
||||
connected = c.conn.connected
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"<Client init:%q handlers:%s connected:%t reconnecting:%t tries:%d>",
|
||||
c.initTime.String(), c.Handlers.Len(), connected, c.reconnecting, c.tries,
|
||||
)
|
||||
}
|
||||
|
||||
// Connect attempts to connect to the given IRC server
|
||||
func (c *Client) Connect() error {
|
||||
// Clean up any old running stuff.
|
||||
|
|
|
@ -120,7 +120,7 @@ func (c *Caller) String() string {
|
|||
}
|
||||
c.mu.RUnlock()
|
||||
|
||||
return fmt.Sprintf("<Caller() external:%d internal:%d>", c.Len(), total)
|
||||
return fmt.Sprintf("<Caller external:%d internal:%d>", c.Len(), total)
|
||||
}
|
||||
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
|
Loading…
Reference in New Issue