*: set zap as default logger, remove capnslog
Set zap as default logger. Remove capnslog and deprecated logging flags.
This commit is contained in:
@ -65,7 +65,6 @@ func TestSnapshotV3RestoreMultiMemberAdd(t *testing.T) {
|
|||||||
cfg := embed.NewConfig()
|
cfg := embed.NewConfig()
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
cfg.Name = "3"
|
cfg.Name = "3"
|
||||||
cfg.InitialClusterToken = testClusterTkn
|
cfg.InitialClusterToken = testClusterTkn
|
||||||
cfg.ClusterState = "existing"
|
cfg.ClusterState = "existing"
|
||||||
|
@ -47,7 +47,6 @@ func TestSnapshotV3RestoreSingle(t *testing.T) {
|
|||||||
cfg := embed.NewConfig()
|
cfg := embed.NewConfig()
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
cfg.Name = "s1"
|
cfg.Name = "s1"
|
||||||
cfg.InitialClusterToken = testClusterTkn
|
cfg.InitialClusterToken = testClusterTkn
|
||||||
cfg.ClusterState = "existing"
|
cfg.ClusterState = "existing"
|
||||||
@ -200,7 +199,6 @@ func createSnapshotFile(t *testing.T, kvs []kv) string {
|
|||||||
cfg := embed.NewConfig()
|
cfg := embed.NewConfig()
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
cfg.Name = "default"
|
cfg.Name = "default"
|
||||||
cfg.ClusterState = "new"
|
cfg.ClusterState = "new"
|
||||||
cfg.LCUrls, cfg.ACUrls = cURLs, cURLs
|
cfg.LCUrls, cfg.ACUrls = cURLs, cURLs
|
||||||
@ -267,7 +265,6 @@ func restoreCluster(t *testing.T, clusterN int, dbPath string) (
|
|||||||
cfg := embed.NewConfig()
|
cfg := embed.NewConfig()
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
cfg.Name = fmt.Sprintf("%d", i)
|
cfg.Name = fmt.Sprintf("%d", i)
|
||||||
cfg.InitialClusterToken = testClusterTkn
|
cfg.InitialClusterToken = testClusterTkn
|
||||||
cfg.ClusterState = "existing"
|
cfg.ClusterState = "existing"
|
||||||
|
@ -290,8 +290,8 @@ type Config struct {
|
|||||||
ListenMetricsUrls []url.URL
|
ListenMetricsUrls []url.URL
|
||||||
ListenMetricsUrlsJSON string `json:"listen-metrics-urls"`
|
ListenMetricsUrlsJSON string `json:"listen-metrics-urls"`
|
||||||
|
|
||||||
// Logger is logger options: "zap", "capnslog".
|
// Logger is logger options: currently only supports "zap".
|
||||||
// WARN: "capnslog" is being deprecated in v3.5.
|
// "capnslog" is removed in v3.5.
|
||||||
Logger string `json:"logger"`
|
Logger string `json:"logger"`
|
||||||
// LogLevel configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
|
// LogLevel configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
|
||||||
LogLevel string `json:"log-level"`
|
LogLevel string `json:"log-level"`
|
||||||
@ -322,19 +322,6 @@ type Config struct {
|
|||||||
|
|
||||||
// EnableGRPCGateway is false to disable grpc gateway.
|
// EnableGRPCGateway is false to disable grpc gateway.
|
||||||
EnableGRPCGateway bool `json:"enable-grpc-gateway"`
|
EnableGRPCGateway bool `json:"enable-grpc-gateway"`
|
||||||
|
|
||||||
// TO BE DEPRECATED
|
|
||||||
|
|
||||||
// DeprecatedLogOutput is to be deprecated in v3.5.
|
|
||||||
// Just here for safe migration in v3.4.
|
|
||||||
DeprecatedLogOutput []string `json:"log-output"`
|
|
||||||
// Debug is true, to enable debug level logging.
|
|
||||||
// WARNING: to be deprecated in 3.5. Use "--log-level=debug" instead.
|
|
||||||
Debug bool `json:"debug"`
|
|
||||||
// LogPkgLevels is being deprecated in v3.5.
|
|
||||||
// Only valid if "logger" option is "capnslog".
|
|
||||||
// WARN: DO NOT USE THIS!
|
|
||||||
LogPkgLevels string `json:"log-package-levels"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// configYAML holds the config suitable for yaml parsing
|
// configYAML holds the config suitable for yaml parsing
|
||||||
@ -411,14 +398,11 @@ func NewConfig() *Config {
|
|||||||
|
|
||||||
PreVote: false, // TODO: enable by default in v3.5
|
PreVote: false, // TODO: enable by default in v3.5
|
||||||
|
|
||||||
loggerMu: new(sync.RWMutex),
|
loggerMu: new(sync.RWMutex),
|
||||||
logger: nil,
|
logger: nil,
|
||||||
Logger: "capnslog",
|
Logger: "zap",
|
||||||
DeprecatedLogOutput: []string{DefaultLogOutput},
|
LogOutputs: []string{DefaultLogOutput},
|
||||||
LogOutputs: []string{DefaultLogOutput},
|
LogLevel: logutil.DefaultLogLevel,
|
||||||
Debug: false,
|
|
||||||
LogLevel: logutil.DefaultLogLevel,
|
|
||||||
LogPkgLevels: "",
|
|
||||||
}
|
}
|
||||||
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
|
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
|
||||||
return cfg
|
return cfg
|
||||||
|
@ -16,16 +16,11 @@ package embed
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"reflect"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.etcd.io/etcd/pkg/logutil"
|
"go.etcd.io/etcd/pkg/logutil"
|
||||||
|
|
||||||
"github.com/coreos/pkg/capnslog"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -46,91 +41,9 @@ var grpcLogOnce = new(sync.Once)
|
|||||||
// setupLogging initializes etcd logging.
|
// setupLogging initializes etcd logging.
|
||||||
// Must be called after flag parsing or finishing configuring embed.Config.
|
// Must be called after flag parsing or finishing configuring embed.Config.
|
||||||
func (cfg *Config) setupLogging() error {
|
func (cfg *Config) setupLogging() error {
|
||||||
// handle "DeprecatedLogOutput" in v3.4
|
|
||||||
// TODO: remove "DeprecatedLogOutput" in v3.5
|
|
||||||
len1 := len(cfg.DeprecatedLogOutput)
|
|
||||||
len2 := len(cfg.LogOutputs)
|
|
||||||
if len1 != len2 {
|
|
||||||
switch {
|
|
||||||
case len1 > len2: // deprecate "log-output" flag is used
|
|
||||||
fmt.Fprintln(os.Stderr, "'--log-output' flag has been deprecated! Please use '--log-outputs'!")
|
|
||||||
cfg.LogOutputs = cfg.DeprecatedLogOutput
|
|
||||||
case len1 < len2: // "--log-outputs" flag has been set with multiple writers
|
|
||||||
cfg.DeprecatedLogOutput = []string{}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if len1 > 1 {
|
|
||||||
return errors.New("both '--log-output' and '--log-outputs' are set; only set '--log-outputs'")
|
|
||||||
}
|
|
||||||
if len1 < 1 {
|
|
||||||
return errors.New("either '--log-output' or '--log-outputs' flag must be set")
|
|
||||||
}
|
|
||||||
if reflect.DeepEqual(cfg.DeprecatedLogOutput, cfg.LogOutputs) && cfg.DeprecatedLogOutput[0] != DefaultLogOutput {
|
|
||||||
return fmt.Errorf("'--log-output=%q' and '--log-outputs=%q' are incompatible; only set --log-outputs", cfg.DeprecatedLogOutput, cfg.LogOutputs)
|
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(cfg.DeprecatedLogOutput, []string{DefaultLogOutput}) {
|
|
||||||
fmt.Fprintf(os.Stderr, "[WARNING] Deprecated '--log-output' flag is set to %q\n", cfg.DeprecatedLogOutput)
|
|
||||||
fmt.Fprintln(os.Stderr, "Please use '--log-outputs' flag")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove after deprecating log related flags in v3.5
|
|
||||||
if cfg.Debug {
|
|
||||||
fmt.Fprintf(os.Stderr, "[WARNING] Deprecated '--debug' flag is set to %v (use '--log-level=debug' instead\n", cfg.Debug)
|
|
||||||
}
|
|
||||||
if cfg.Debug && cfg.LogLevel != "debug" {
|
|
||||||
fmt.Fprintf(os.Stderr, "[WARNING] Deprecated '--debug' flag is set to %v with inconsistent '--log-level=%s' flag\n", cfg.Debug, cfg.LogLevel)
|
|
||||||
}
|
|
||||||
if cfg.Logger == "capnslog" {
|
|
||||||
fmt.Fprintf(os.Stderr, "[WARNING] Deprecated '--logger=%s' flag is set; use '--logger=zap' flag instead\n", cfg.Logger)
|
|
||||||
}
|
|
||||||
if cfg.LogPkgLevels != "" {
|
|
||||||
fmt.Fprintf(os.Stderr, "[WARNING] Deprecated '--log-package-levels=%s' flag is set; use '--logger=zap' flag instead\n", cfg.LogPkgLevels)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch cfg.Logger {
|
switch cfg.Logger {
|
||||||
case "capnslog": // TODO: deprecate this in v3.5
|
case "capnslog": // removed in v3.5
|
||||||
cfg.ClientTLSInfo.HandshakeFailure = logTLSHandshakeFailure
|
return fmt.Errorf("--logger=capnslog is removed in v3.5")
|
||||||
cfg.PeerTLSInfo.HandshakeFailure = logTLSHandshakeFailure
|
|
||||||
|
|
||||||
if cfg.Debug {
|
|
||||||
capnslog.SetGlobalLogLevel(capnslog.DEBUG)
|
|
||||||
grpc.EnableTracing = true
|
|
||||||
// enable info, warning, error
|
|
||||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr))
|
|
||||||
} else {
|
|
||||||
capnslog.SetGlobalLogLevel(logutil.ConvertToCapnslogLogLevel(cfg.LogLevel))
|
|
||||||
// only discard info
|
|
||||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, os.Stderr, os.Stderr))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: deprecate with "capnslog"
|
|
||||||
if cfg.LogPkgLevels != "" {
|
|
||||||
repoLog := capnslog.MustRepoLogger("go.etcd.io/etcd")
|
|
||||||
settings, err := repoLog.ParseLogLevelConfig(cfg.LogPkgLevels)
|
|
||||||
if err != nil {
|
|
||||||
plog.Warningf("couldn't parse log level string: %s, continuing with default levels", err.Error())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
repoLog.SetLogLevel(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(cfg.LogOutputs) != 1 {
|
|
||||||
return fmt.Errorf("--logger=capnslog supports only 1 value in '--log-outputs', got %q", cfg.LogOutputs)
|
|
||||||
}
|
|
||||||
// capnslog initially SetFormatter(NewDefaultFormatter(os.Stderr))
|
|
||||||
// where NewDefaultFormatter returns NewJournaldFormatter when syscall.Getppid() == 1
|
|
||||||
// specify 'stdout' or 'stderr' to skip journald logging even when running under systemd
|
|
||||||
output := cfg.LogOutputs[0]
|
|
||||||
switch output {
|
|
||||||
case StdErrLogOutput:
|
|
||||||
capnslog.SetFormatter(capnslog.NewPrettyFormatter(os.Stderr, cfg.Debug))
|
|
||||||
case StdOutLogOutput:
|
|
||||||
capnslog.SetFormatter(capnslog.NewPrettyFormatter(os.Stdout, cfg.Debug))
|
|
||||||
case DefaultLogOutput:
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unknown log-output %q (only supports %q, %q, %q)", output, DefaultLogOutput, StdErrLogOutput, StdOutLogOutput)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "zap":
|
case "zap":
|
||||||
if len(cfg.LogOutputs) == 0 {
|
if len(cfg.LogOutputs) == 0 {
|
||||||
@ -175,10 +88,7 @@ func (cfg *Config) setupLogging() error {
|
|||||||
copied.ErrorOutputPaths = errOutputPaths
|
copied.ErrorOutputPaths = errOutputPaths
|
||||||
copied = logutil.MergeOutputPaths(copied)
|
copied = logutil.MergeOutputPaths(copied)
|
||||||
copied.Level = zap.NewAtomicLevelAt(logutil.ConvertToZapLevel(cfg.LogLevel))
|
copied.Level = zap.NewAtomicLevelAt(logutil.ConvertToZapLevel(cfg.LogLevel))
|
||||||
if cfg.Debug || cfg.LogLevel == "debug" {
|
if cfg.LogLevel == "debug" {
|
||||||
// enable tracing even when "--debug --log-level info"
|
|
||||||
// in order to keep backward compatibility with <= v3.3
|
|
||||||
// TODO: remove "Debug" check in v3.5
|
|
||||||
grpc.EnableTracing = true
|
grpc.EnableTracing = true
|
||||||
}
|
}
|
||||||
if cfg.ZapLoggerBuilder == nil {
|
if cfg.ZapLoggerBuilder == nil {
|
||||||
@ -221,10 +131,7 @@ func (cfg *Config) setupLogging() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lvl := zap.NewAtomicLevelAt(logutil.ConvertToZapLevel(cfg.LogLevel))
|
lvl := zap.NewAtomicLevelAt(logutil.ConvertToZapLevel(cfg.LogLevel))
|
||||||
if cfg.Debug || cfg.LogLevel == "debug" {
|
if cfg.LogLevel == "debug" {
|
||||||
// enable tracing even when "--debug --log-level info"
|
|
||||||
// in order to keep backward compatibility with <= v3.3
|
|
||||||
// TODO: remove "Debug" check in v3.5
|
|
||||||
grpc.EnableTracing = true
|
grpc.EnableTracing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,6 @@ func TestAutoCompactionModeInvalid(t *testing.T) {
|
|||||||
cfg := NewConfig()
|
cfg := NewConfig()
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
cfg.AutoCompactionMode = "period"
|
cfg.AutoCompactionMode = "period"
|
||||||
err := cfg.Validate()
|
err := cfg.Validate()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -201,7 +201,6 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
|||||||
LoggerConfig: cfg.loggerConfig,
|
LoggerConfig: cfg.loggerConfig,
|
||||||
LoggerCore: cfg.loggerCore,
|
LoggerCore: cfg.loggerCore,
|
||||||
LoggerWriteSyncer: cfg.loggerWriteSyncer,
|
LoggerWriteSyncer: cfg.loggerWriteSyncer,
|
||||||
Debug: cfg.Debug,
|
|
||||||
ForceNewCluster: cfg.ForceNewCluster,
|
ForceNewCluster: cfg.ForceNewCluster,
|
||||||
EnableGRPCGateway: cfg.EnableGRPCGateway,
|
EnableGRPCGateway: cfg.EnableGRPCGateway,
|
||||||
EnableLeaseCheckpoint: cfg.ExperimentalEnableLeaseCheckpoint,
|
EnableLeaseCheckpoint: cfg.ExperimentalEnableLeaseCheckpoint,
|
||||||
@ -691,10 +690,10 @@ func configureClientListeners(cfg *Config) (sctxs map[string]*serveCtx, err erro
|
|||||||
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
sctx.userHandlers[k] = cfg.UserHandlers[k]
|
||||||
}
|
}
|
||||||
sctx.serviceRegister = cfg.ServiceRegister
|
sctx.serviceRegister = cfg.ServiceRegister
|
||||||
if cfg.EnablePprof || cfg.Debug {
|
if cfg.EnablePprof || cfg.LogLevel == "debug" {
|
||||||
sctx.registerPprof()
|
sctx.registerPprof()
|
||||||
}
|
}
|
||||||
if cfg.Debug {
|
if cfg.LogLevel == "debug" {
|
||||||
sctx.registerTrace()
|
sctx.registerTrace()
|
||||||
}
|
}
|
||||||
sctxs[addr] = sctx
|
sctxs[addr] = sctx
|
||||||
|
@ -221,12 +221,9 @@ func newConfig() *config {
|
|||||||
fs.Var(flags.NewUniqueStringsValue("*"), "host-whitelist", "Comma-separated acceptable hostnames from HTTP client requests, if server is not secure (empty means allow all).")
|
fs.Var(flags.NewUniqueStringsValue("*"), "host-whitelist", "Comma-separated acceptable hostnames from HTTP client requests, if server is not secure (empty means allow all).")
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
fs.StringVar(&cfg.ec.Logger, "logger", "capnslog", "Specify 'zap' for structured logging or 'capnslog'. WARN: 'capnslog' is being deprecated in v3.5.")
|
fs.StringVar(&cfg.ec.Logger, "logger", "zap", "Currently only supports 'zap' for structured logging.")
|
||||||
fs.Var(flags.NewUniqueStringsValue(embed.DefaultLogOutput), "log-output", "[TO BE DEPRECATED IN v3.5] use '--log-outputs'.")
|
|
||||||
fs.Var(flags.NewUniqueStringsValue(embed.DefaultLogOutput), "log-outputs", "Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets.")
|
fs.Var(flags.NewUniqueStringsValue(embed.DefaultLogOutput), "log-outputs", "Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets.")
|
||||||
fs.BoolVar(&cfg.ec.Debug, "debug", false, "[TO BE DEPRECATED IN v3.5] Enable debug-level logging for etcd. Use '--log-level=debug' instead.")
|
|
||||||
fs.StringVar(&cfg.ec.LogLevel, "log-level", logutil.DefaultLogLevel, "Configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.")
|
fs.StringVar(&cfg.ec.LogLevel, "log-level", logutil.DefaultLogLevel, "Configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.")
|
||||||
fs.StringVar(&cfg.ec.LogPkgLevels, "log-package-levels", "", "[TO BE DEPRECATED IN v3.5] Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG').")
|
|
||||||
|
|
||||||
// version
|
// version
|
||||||
fs.BoolVar(&cfg.printVersion, "version", false, "Print the version and exit.")
|
fs.BoolVar(&cfg.printVersion, "version", false, "Print the version and exit.")
|
||||||
@ -336,8 +333,6 @@ func (cfg *config) configFromCmdLine() error {
|
|||||||
|
|
||||||
cfg.ec.CipherSuites = flags.StringsFromFlag(cfg.cf.flagSet, "cipher-suites")
|
cfg.ec.CipherSuites = flags.StringsFromFlag(cfg.cf.flagSet, "cipher-suites")
|
||||||
|
|
||||||
// TODO: remove this in v3.5
|
|
||||||
cfg.ec.DeprecatedLogOutput = flags.UniqueStringsFromFlag(cfg.cf.flagSet, "log-output")
|
|
||||||
cfg.ec.LogOutputs = flags.UniqueStringsFromFlag(cfg.cf.flagSet, "log-outputs")
|
cfg.ec.LogOutputs = flags.UniqueStringsFromFlag(cfg.cf.flagSet, "log-outputs")
|
||||||
|
|
||||||
cfg.ec.ClusterState = cfg.cf.clusterState.String()
|
cfg.ec.ClusterState = cfg.cf.clusterState.String()
|
||||||
|
@ -174,8 +174,8 @@ Profiling and Monitoring:
|
|||||||
List of URLs to listen on for the metrics and health endpoints.
|
List of URLs to listen on for the metrics and health endpoints.
|
||||||
|
|
||||||
Logging:
|
Logging:
|
||||||
--logger 'capnslog'
|
--logger 'zap'
|
||||||
Specify 'zap' for structured logging or 'capnslog'. [WARN] 'capnslog' will be deprecated in v3.5.
|
Currently only supports 'zap' for structured logging.
|
||||||
--log-outputs 'default'
|
--log-outputs 'default'
|
||||||
Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets.
|
Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets.
|
||||||
--log-level 'info'
|
--log-level 'info'
|
||||||
@ -214,12 +214,7 @@ Unsafe feature:
|
|||||||
Force to create a new one-member cluster.
|
Force to create a new one-member cluster.
|
||||||
|
|
||||||
CAUTIOUS with unsafe flag! It may break the guarantees given by the consensus protocol!
|
CAUTIOUS with unsafe flag! It may break the guarantees given by the consensus protocol!
|
||||||
|
|
||||||
TO BE DEPRECATED:
|
|
||||||
|
|
||||||
--debug 'false'
|
|
||||||
Enable debug-level logging for etcd. [WARN] Will be deprecated in v3.5. Use '--log-level=debug' instead.
|
|
||||||
--log-package-levels ''
|
|
||||||
Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG').
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Add back "TO BE DEPRECATED" section if needed
|
||||||
|
@ -147,8 +147,6 @@ type ServerConfig struct {
|
|||||||
LoggerCore zapcore.Core
|
LoggerCore zapcore.Core
|
||||||
LoggerWriteSyncer zapcore.WriteSyncer
|
LoggerWriteSyncer zapcore.WriteSyncer
|
||||||
|
|
||||||
Debug bool
|
|
||||||
|
|
||||||
ForceNewCluster bool
|
ForceNewCluster bool
|
||||||
|
|
||||||
// EnableLeaseCheckpoint enables primary lessor to persist lease remainingTTL to prevent indefinite auto-renewal of long lived leases.
|
// EnableLeaseCheckpoint enables primary lessor to persist lease remainingTTL to prevent indefinite auto-renewal of long lived leases.
|
||||||
|
@ -58,7 +58,6 @@ func TestEmbedEtcd(t *testing.T) {
|
|||||||
tests[i].cfg = *embed.NewConfig()
|
tests[i].cfg = *embed.NewConfig()
|
||||||
tests[i].cfg.Logger = "zap"
|
tests[i].cfg.Logger = "zap"
|
||||||
tests[i].cfg.LogOutputs = []string{"/dev/null"}
|
tests[i].cfg.LogOutputs = []string{"/dev/null"}
|
||||||
tests[i].cfg.Debug = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tests[0].cfg.Durl = "abc"
|
tests[0].cfg.Durl = "abc"
|
||||||
@ -184,7 +183,6 @@ func newEmbedURLs(secure bool, n int) (urls []url.URL) {
|
|||||||
func setupEmbedCfg(cfg *embed.Config, curls []url.URL, purls []url.URL) {
|
func setupEmbedCfg(cfg *embed.Config, curls []url.URL, purls []url.URL) {
|
||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
cfg.Debug = false
|
|
||||||
|
|
||||||
cfg.ClusterState = "new"
|
cfg.ClusterState = "new"
|
||||||
cfg.LCUrls, cfg.ACUrls = curls, curls
|
cfg.LCUrls, cfg.ACUrls = curls, curls
|
||||||
|
@ -42,7 +42,6 @@ func setupEmbedCfg(cfg *embed.Config, curls, purls, ics []url.URL) {
|
|||||||
cfg.Logger = "zap"
|
cfg.Logger = "zap"
|
||||||
cfg.LogOutputs = []string{"/dev/null"}
|
cfg.LogOutputs = []string{"/dev/null"}
|
||||||
// []string{"stderr"} to enable server logging
|
// []string{"stderr"} to enable server logging
|
||||||
cfg.Debug = false
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
cfg.Dir, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("%016X", time.Now().UnixNano()))
|
cfg.Dir, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("%016X", time.Now().UnixNano()))
|
||||||
|
Reference in New Issue
Block a user