mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: rename "LogOutput" to "LogOutputs"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
3ea7a5d0bd
commit
f99cb35d29
@ -265,13 +265,13 @@ type Config struct {
|
||||
// WARN: "capnslog" is being deprecated in v3.5.
|
||||
Logger string `json:"logger"`
|
||||
|
||||
// LogOutput is either:
|
||||
// LogOutputs is either:
|
||||
// - "default" as os.Stderr,
|
||||
// - "stderr" as os.Stderr,
|
||||
// - "stdout" as os.Stdout,
|
||||
// - file path to append server logs to.
|
||||
// It can be multiple when "Logger" is zap.
|
||||
LogOutput []string `json:"log-output"`
|
||||
LogOutputs []string `json:"log-output"`
|
||||
// Debug is true, to enable debug level logging.
|
||||
Debug bool `json:"debug"`
|
||||
|
||||
@ -371,7 +371,7 @@ func NewConfig() *Config {
|
||||
loggerMu: new(sync.RWMutex),
|
||||
logger: nil,
|
||||
Logger: "capnslog",
|
||||
LogOutput: []string{DefaultLogOutput},
|
||||
LogOutputs: []string{DefaultLogOutput},
|
||||
Debug: false,
|
||||
LogPkgLevels: "",
|
||||
}
|
||||
@ -433,14 +433,14 @@ func (cfg *Config) setupLogging() error {
|
||||
repoLog.SetLogLevel(settings)
|
||||
}
|
||||
|
||||
if len(cfg.LogOutput) != 1 {
|
||||
fmt.Printf("expected only 1 value in 'log-output', got %v\n", cfg.LogOutput)
|
||||
if len(cfg.LogOutputs) != 1 {
|
||||
fmt.Printf("expected only 1 value in 'log-output', got %v\n", cfg.LogOutputs)
|
||||
os.Exit(1)
|
||||
}
|
||||
// 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.LogOutput[0]
|
||||
output := cfg.LogOutputs[0]
|
||||
switch output {
|
||||
case "stdout":
|
||||
capnslog.SetFormatter(capnslog.NewPrettyFormatter(os.Stdout, cfg.Debug))
|
||||
@ -452,11 +452,11 @@ func (cfg *Config) setupLogging() error {
|
||||
}
|
||||
|
||||
case "zap":
|
||||
if len(cfg.LogOutput) == 0 {
|
||||
cfg.LogOutput = []string{DefaultLogOutput}
|
||||
if len(cfg.LogOutputs) == 0 {
|
||||
cfg.LogOutputs = []string{DefaultLogOutput}
|
||||
}
|
||||
if len(cfg.LogOutput) > 1 {
|
||||
for _, v := range cfg.LogOutput {
|
||||
if len(cfg.LogOutputs) > 1 {
|
||||
for _, v := range cfg.LogOutputs {
|
||||
if v == DefaultLogOutput {
|
||||
panic(fmt.Errorf("multi logoutput for %q is not supported yet", DefaultLogOutput))
|
||||
}
|
||||
@ -479,7 +479,7 @@ func (cfg *Config) setupLogging() error {
|
||||
}
|
||||
outputPaths, errOutputPaths := make(map[string]struct{}), make(map[string]struct{})
|
||||
isJournald := false
|
||||
for _, v := range cfg.LogOutput {
|
||||
for _, v := range cfg.LogOutputs {
|
||||
switch v {
|
||||
case DefaultLogOutput:
|
||||
if syscall.Getppid() == 1 {
|
||||
|
@ -312,7 +312,7 @@ func (cfg *config) configFromCmdLine() error {
|
||||
oss = append(oss, v)
|
||||
}
|
||||
sort.Strings(oss)
|
||||
cfg.ec.LogOutput = oss
|
||||
cfg.ec.LogOutputs = oss
|
||||
|
||||
cfg.ec.ClusterState = cfg.cf.clusterState.String()
|
||||
cfg.cp.Fallback = cfg.cf.fallback.String()
|
||||
|
Loading…
x
Reference in New Issue
Block a user