etcd: Remove the capnslog stuff and switch to zap

Unfortunately, this doesn't give us a way to pass in our own logger
function, and afaict by reading the source, it's not possible because
the necessary methods are private. In any case, this is left as a future
exercise.
This commit is contained in:
James Shubin
2019-12-17 03:40:44 -05:00
parent e73007c398
commit f0aa96ea8c
2 changed files with 3 additions and 9 deletions

View File

@@ -145,6 +145,9 @@ func (obj *EmbdEtcd) runServer(newCluster bool, peerURLsMap etcdtypes.URLsMap) (
cfg.ACUrls = aCUrls cfg.ACUrls = aCUrls
cfg.StrictReconfigCheck = false // XXX: workaround https://github.com/etcd-io/etcd/issues/6305 cfg.StrictReconfigCheck = false // XXX: workaround https://github.com/etcd-io/etcd/issues/6305
cfg.MaxTxnOps = DefaultMaxTxnOps cfg.MaxTxnOps = DefaultMaxTxnOps
cfg.Logger = "zap"
//cfg.LogOutputs = []string{} // FIXME: add a way to pass in our logf func
cfg.LogLevel = "error" // keep things quieter for now
cfg.InitialCluster = initialPeerURLsMap.String() // including myself! cfg.InitialCluster = initialPeerURLsMap.String() // including myself!
if newCluster { if newCluster {

View File

@@ -22,8 +22,6 @@ import (
"log" "log"
"os" "os"
"time" "time"
"github.com/coreos/pkg/capnslog"
) )
func hello(program, version string, flags Flags) { func hello(program, version string, flags Flags) {
@@ -36,14 +34,7 @@ func hello(program, version string, flags Flags) {
logFlags = logFlags - log.Ldate // remove the date for now logFlags = logFlags - log.Ldate // remove the date for now
log.SetFlags(logFlags) log.SetFlags(logFlags)
// un-hijack from capnslog...
// XXX: move this to the etcd package when new version deprecates capnslog
log.SetOutput(os.Stderr) log.SetOutput(os.Stderr)
if flags.Verbose {
capnslog.SetFormatter(capnslog.NewLogFormatter(os.Stderr, "(etcd) ", logFlags))
} else {
capnslog.SetFormatter(capnslog.NewNilFormatter())
}
if program == "" { if program == "" {
program = "<unknown>" program = "<unknown>"