mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
pkg/logutil: change to "MergeOutputPaths"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
parent
7e9a26eb6d
commit
6ee0c5c5dd
@ -53,15 +53,12 @@ var DefaultZapLoggerConfig = zap.Config{
|
|||||||
ErrorOutputPaths: []string{"stderr"},
|
ErrorOutputPaths: []string{"stderr"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddOutputPaths adds output paths to the existing output paths, resolving conflicts.
|
// MergeOutputPaths merges logging output paths, resolving conflicts.
|
||||||
func AddOutputPaths(cfg zap.Config, outputPaths, errorOutputPaths []string) zap.Config {
|
func MergeOutputPaths(cfg zap.Config) zap.Config {
|
||||||
outputs := make(map[string]struct{})
|
outputs := make(map[string]struct{})
|
||||||
for _, v := range cfg.OutputPaths {
|
for _, v := range cfg.OutputPaths {
|
||||||
outputs[v] = struct{}{}
|
outputs[v] = struct{}{}
|
||||||
}
|
}
|
||||||
for _, v := range outputPaths {
|
|
||||||
outputs[v] = struct{}{}
|
|
||||||
}
|
|
||||||
outputSlice := make([]string, 0)
|
outputSlice := make([]string, 0)
|
||||||
if _, ok := outputs["/dev/null"]; ok {
|
if _, ok := outputs["/dev/null"]; ok {
|
||||||
// "/dev/null" to discard all
|
// "/dev/null" to discard all
|
||||||
@ -78,9 +75,6 @@ func AddOutputPaths(cfg zap.Config, outputPaths, errorOutputPaths []string) zap.
|
|||||||
for _, v := range cfg.ErrorOutputPaths {
|
for _, v := range cfg.ErrorOutputPaths {
|
||||||
errOutputs[v] = struct{}{}
|
errOutputs[v] = struct{}{}
|
||||||
}
|
}
|
||||||
for _, v := range errorOutputPaths {
|
|
||||||
errOutputs[v] = struct{}{}
|
|
||||||
}
|
|
||||||
errOutputSlice := make([]string, 0)
|
errOutputSlice := make([]string, 0)
|
||||||
if _, ok := errOutputs["/dev/null"]; ok {
|
if _, ok := errOutputs["/dev/null"]; ok {
|
||||||
// "/dev/null" to discard all
|
// "/dev/null" to discard all
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user