From 8eb32d9bdeeaf6c4923b3c9f02ae0c9fe8eecbf3 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 14 Sep 2018 17:02:29 -0400 Subject: [PATCH] Add debug config option --- config.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index a7fd817..8b67529 100644 --- a/config.go +++ b/config.go @@ -35,6 +35,8 @@ type Config struct { AdvertiseAddress string // Peers is a local cache of peer members Peers []string + // Debug output for memberlist + Debug bool } func (a *Agent) Config() *Config { @@ -58,9 +60,9 @@ func (cfg *Config) memberListConfig(peerUpdateChan chan bool, nodeEventChan chan mc.Delegate = NewAgentDelegate(cfg.NodeName, cfg.Address, peerUpdateChan, nodeEventChan) mc.Events = NewEventHandler(nodeEventChan) - // disable logging for memberlist - // TODO: enable if debug - mc.Logger = log.New(ioutil.Discard, "", 0) + if !cfg.Debug { + mc.Logger = log.New(ioutil.Discard, "", 0) + } host, port, err := net.SplitHostPort(cfg.ClusterAddress) if err != nil {