From 036a41acdfe3e0c494fe1242f8fff41b122ea73e Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 3 Jan 2015 00:17:14 -0500 Subject: [PATCH] add --debug option for client --- client.go | 3 +++ whisper.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/client.go b/client.go index d80f9be..7df7e5b 100644 --- a/client.go +++ b/client.go @@ -197,6 +197,9 @@ func (c *Client) sendRequest(r request) (chan Envelope, error) { } func (c *Client) info(template string, args ...interface{}) { + if !options.debug { + return + } c.mu.Lock() defer c.mu.Unlock() diff --git a/whisper.go b/whisper.go index bbd2a22..1ac3681 100644 --- a/whisper.go +++ b/whisper.go @@ -21,6 +21,7 @@ var options struct { key string publicKey string nick string + debug bool } func exit(status int, template string, args ...interface{}) { @@ -69,4 +70,5 @@ func init() { flag.StringVar(&options.key, "key", "whisper_key", "rsa key to use") flag.StringVar(&options.publicKey, "public-key", "", "public rsa key to use") flag.StringVar(&options.nick, "nick", "", "nick to use in chat") + flag.BoolVar(&options.debug, "debug", false, "include debug messages") }