mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
fix for issue 2976 (#3313)
fix for null pointer exception in ZookeeperLogger
This commit is contained in:
parent
bf4a279a91
commit
2c163f32a5
|
@ -68,7 +68,7 @@ func NewDiscovery(
|
|||
}
|
||||
|
||||
conn, _, err := zk.Connect(srvs, timeout)
|
||||
conn.SetLogger(treecache.ZookeeperLogger{})
|
||||
conn.SetLogger(treecache.NewZookeeperLogger(logger))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -49,6 +49,11 @@ type ZookeeperLogger struct {
|
|||
logger log.Logger
|
||||
}
|
||||
|
||||
// NewZookeeperLogger is a constructor for ZookeeperLogger
|
||||
func NewZookeeperLogger(logger log.Logger) ZookeeperLogger {
|
||||
return ZookeeperLogger{logger: logger}
|
||||
}
|
||||
|
||||
// Implements zk.Logger
|
||||
func (zl ZookeeperLogger) Printf(s string, i ...interface{}) {
|
||||
level.Info(zl.logger).Log("msg", fmt.Sprintf(s, i...))
|
||||
|
|
Loading…
Reference in a new issue