From 557d8b8a24635ea19566b45165cb310428bc05df Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Mon, 25 Apr 2016 20:10:55 -0700 Subject: [PATCH] Make use of logger interface inside of the Consul BE --- physical/consul.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/physical/consul.go b/physical/consul.go index 21c66edcb..c5aacf9ac 100644 --- a/physical/consul.go +++ b/physical/consul.go @@ -82,9 +82,11 @@ func newConsulBackend(conf map[string]string, logger *log.Logger) (Backend, erro // Ensure path is suffixed but not prefixed if !strings.HasSuffix(path, "/") { + logger.Printf("[WARN]: consul: appending trailing forward slash to path") path += "/" } if strings.HasPrefix(path, "/") { + logger.Printf("[WARN]: consul: trimming path of its forward slash") path = strings.TrimPrefix(path, "/") } @@ -158,6 +160,7 @@ func newConsulBackend(conf map[string]string, logger *log.Logger) (Backend, erro if err != nil { return nil, errwrap.Wrapf("failed parsing max_parallel parameter: {{err}}", err) } + logger.Printf("[DEBUG]: consul: max_parallel set to %d", maxParInt) } // Setup the backend @@ -213,7 +216,7 @@ func (c *ConsulBackend) AdvertiseActive(active bool) error { return nil } - // wtb logger c.logger.Printf("[WARN] service registration failed: %v", err) + c.logger.Printf("[WARN] consul: service registration failed: %v", err) c.serviceLock.Unlock() time.Sleep(registrationRetryInterval) c.serviceLock.Lock() @@ -304,13 +307,13 @@ func (c *ConsulBackend) RunServiceDiscovery(shutdownCh ShutdownChannel, advertis for { select { case <-shutdownCh: - // wtb logger: log.Printf("[DEBUG]: Shutting down consul backend") + c.logger.Printf("[INFO]: consul: Shutting down consul backend") break shutdown } } if err := agent.ServiceDeregister(serviceID); err != nil { - // wtb logger: log.Printf("[WARNING]: service deregistration failed: {{err}}", err) + c.logger.Printf("[WARN]: consul: service deregistration failed: {{err}}", err) } c.running = false }()