Skip to content
This repository was archived by the owner on Nov 20, 2021. It is now read-only.

Commit 0253ac6

Browse files
authored
Merge pull request #9 from criticalstack/ktravis/etcd-log-level
Add manager.Config option for etcd log level
2 parents 0d63a3a + 1254c36 commit 0253ac6

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/manager/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/pkg/errors"
1919
bolt "go.etcd.io/bbolt"
2020
"go.uber.org/zap"
21+
"go.uber.org/zap/zapcore"
2122
)
2223

2324
func init() {
@@ -90,6 +91,9 @@ type Config struct {
9091
// configures authentication/transport security within the etcd cluster
9192
PeerSecurity client.SecurityConfig
9293

94+
// configures the level of the logger used by etcd
95+
EtcdLogLevel zapcore.Level
96+
9397
discovery.PeerProvider
9498
snapshot.SnapshotProvider
9599

pkg/manager/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func New(cfg *Config) (*Manager, error) {
5151
RequiredClusterSize: cfg.RequiredClusterSize,
5252
ClientSecurity: cfg.ClientSecurity,
5353
PeerSecurity: cfg.PeerSecurity,
54+
EtcdLogLevel: cfg.EtcdLogLevel,
5455
Debug: cfg.Debug,
5556
EnableLocalListener: true,
5657
}),

pkg/manager/server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ type serverConfig struct {
5353
// add a local client listener (i.e. 127.0.0.1)
5454
EnableLocalListener bool
5555

56+
// configures the level of the logger used by etcd
57+
EtcdLogLevel zapcore.Level
58+
5659
Debug bool
5760
}
5861

@@ -169,7 +172,7 @@ func (s *server) startEtcd(state string, peers []*Peer) error {
169172
cfg.Logger = "zap"
170173
cfg.Debug = s.cfg.Debug
171174
cfg.ZapLoggerBuilder = func(c *embed.Config) error {
172-
l := log.NewLoggerWithLevel("etcd", zapcore.InfoLevel)
175+
l := log.NewLoggerWithLevel("etcd", s.cfg.EtcdLogLevel)
173176
return embed.NewZapCoreLoggerBuilder(l, l.Core(), zapcore.AddSync(os.Stderr))(c)
174177
}
175178
cfg.AutoCompactionMode = embed.CompactorModePeriodic

0 commit comments

Comments
 (0)