Make use of logger interface inside of the Consul BE
This commit is contained in:
parent
aeea7628d6
commit
557d8b8a24
|
@ -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
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue