mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

First, don't panic with invalid --log-outputs. For example: $> ./bin/etcd --log-outputs foo 2018-12-20 15:05:47.988652 C | embed: unknown log-output "foo" (only supports "default", "stderr", "stdout") panic: unknown log-output "foo" (only supports "default", "stderr", "stdout") goroutine 1 [running]: go.etcd.io/etcd/vendor/github.com/coreos/pkg/capnslog.(*PackageLogger).Panicf(0xc000294b00, 0x10fe067, 0x30, 0xc0001fa398, 0x4, 0x4) go.etcd.io/etcd/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go:75 +0x161 go.etcd.io/etcd/embed.(*Config).setupLogging(0xc000291400, 0xc0002a85b0, 0x1) go.etcd.io/etcd/embed/config_logging.go:120 +0x1939 ... Or: $> ./bin/etcd --log-outputs foo,default --logger zap panic: multi logoutput for "default" is not supported yet goroutine 1 [running]: go.etcd.io/etcd/embed.(*Config).setupLogging(0xc000314500, 0xc0001b2f70, 0x1) go.etcd.io/etcd/embed/config_logging.go:129 +0x2437 go.etcd.io/etcd/embed.(*Config).Validate(0xc000314500, 0xc000268a98, 0x127e440) go.etcd.io/etcd/embed/config.go:543 +0x43 Second, don't exit in embed.setupLogging(). Before: $> ./bin/etcd --log-outputs foo,bar --logger=capnslog supports only 1 value in '--log-outputs', got ["bar" "foo"] and after: $> ./bin/etcd --log-outputs foo,bar 2018-12-20 15:10:24.317982 E | etcdmain: error verifying flags, --logger=capnslog supports only 1 value in '--log-outputs', got ["bar" "foo"]. See 'etcd --help'. Third, remove duplicated unique strings code. UniqueStringsFromFlag() is already available to return a sorted slice of values, so just use that. Lastly, fix a tiny logging typo in config.