From 537e41efe2c12aacc55b4eb8187f18f687ffde1d Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Mon, 11 Nov 2013 00:09:30 +0000
Subject: [PATCH] made masterelection slightly more verbose

---
 masterelection/masterelection.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/masterelection/masterelection.go b/masterelection/masterelection.go
index a9e8dc19..c73a67f1 100644
--- a/masterelection/masterelection.go
+++ b/masterelection/masterelection.go
@@ -12,6 +12,16 @@ const (
 	STATE_MASTER
 )
 
+func stateToString(state int) string {
+	switch state {
+	case STATE_SLAVE:
+		return "slave"
+	case STATE_MASTER:
+		return "master"
+	}
+	return ""
+}
+
 type MasterElection struct {
 	client *etcd.Client
 	stop chan bool
@@ -49,6 +59,7 @@ func (m *MasterElection) setState(state int) {
 	if m.State == state {
 		return
 	}
+	log.Printf("masterelection: status=%s", stateToString(state))
 	if m.StateChange != nil {
 		m.StateChange <- state
 	}
-- 
GitLab