Browse Source

Merge pull request #653 from unihorn/49

chore(etcd): print out go-etcd log in VeryVeryVerbose Mode
Yicheng Qin 11 years ago
parent
commit
b2f787a2fd
1 changed files with 13 additions and 0 deletions
  1. 13 0
      etcd.go

+ 13 - 0
etcd.go

@@ -24,6 +24,8 @@ import (
 	"runtime"
 	"time"
 
+	goetcd "github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
+	golog "github.com/coreos/etcd/third_party/github.com/coreos/go-log/log"
 	"github.com/coreos/etcd/third_party/github.com/goraft/raft"
 
 	"github.com/coreos/etcd/config"
@@ -53,6 +55,17 @@ func main() {
 	if config.VeryVeryVerbose {
 		log.Verbose = true
 		raft.SetLogLevel(raft.Trace)
+		goetcd.SetLogger(
+			golog.New(
+				"go-etcd",
+				false,
+				golog.CombinedSink(
+					os.Stdout,
+					"[%s] %s %-9s | %s\n",
+					[]string{"prefix", "time", "priority", "message"},
+				),
+			),
+		)
 	} else if config.VeryVerbose {
 		log.Verbose = true
 		raft.SetLogLevel(raft.Debug)