diff --git a/masterelection/masterelection.go b/masterelection/masterelection.go index a9e8dc193d2a64228018f2c4d03ce027a28afc71..c73a67f1e0e8704c7140f30440d2671024f722b9 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 }