*: better logging

This commit is contained in:
Xiang Li 2014-10-25 21:37:13 -07:00
parent 73215447c1
commit 009b737cef
3 changed files with 6 additions and 4 deletions

View File

@ -526,7 +526,7 @@ func (s *EtcdServer) publish(retryInterval time.Duration) {
cancel() cancel()
switch err { switch err {
case nil: case nil:
log.Printf("etcdserver: published %+v to the cluster", s.attributes) log.Printf("etcdserver: published %+v to cluster %x", s.attributes, s.Cluster.ID())
return return
case ErrStopped: case ErrStopped:
log.Printf("etcdserver: aborting publish because server is stopped") log.Printf("etcdserver: aborting publish because server is stopped")

View File

@ -974,6 +974,7 @@ func TestPublish(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
id: 1, id: 1,
attributes: Attributes{Name: "node1", ClientURLs: []string{"http://a", "http://b"}}, attributes: Attributes{Name: "node1", ClientURLs: []string{"http://a", "http://b"}},
Cluster: &Cluster{},
node: n, node: n,
w: w, w: w,
} }
@ -1007,6 +1008,7 @@ func TestPublish(t *testing.T) {
func TestPublishStopped(t *testing.T) { func TestPublishStopped(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
node: &nodeRecorder{}, node: &nodeRecorder{},
Cluster: &Cluster{},
w: &waitRecorder{}, w: &waitRecorder{},
done: make(chan struct{}), done: make(chan struct{}),
stopped: make(chan struct{}), stopped: make(chan struct{}),

View File

@ -195,7 +195,7 @@ func startEtcd() {
// Start the peer server in a goroutine // Start the peer server in a goroutine
urlStr := u.String() urlStr := u.String()
go func() { go func() {
log.Print("Listening for peers on ", urlStr) log.Print("etcd: listening for peers on ", urlStr)
log.Fatal(http.Serve(l, ph)) log.Fatal(http.Serve(l, ph))
}() }()
} }
@ -214,7 +214,7 @@ func startEtcd() {
urlStr := u.String() urlStr := u.String()
go func() { go func() {
log.Print("Listening for client requests on ", urlStr) log.Print("etcd: listening for client requests on ", urlStr)
log.Fatal(http.Serve(l, ch)) log.Fatal(http.Serve(l, ch))
}() }()
} }
@ -266,7 +266,7 @@ func startProxy() {
host := u.Host host := u.Host
go func() { go func() {
log.Print("Listening for client requests on ", host) log.Print("etcd: proxy listening for client requests on ", host)
log.Fatal(http.Serve(l, ph)) log.Fatal(http.Serve(l, ph))
}() }()
} }