Skip to content

Commit

Permalink
raft: Improve formatting of DescribeMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Jan 20, 2016
1 parent 0928792 commit c185bda
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion raft/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ func DescribeMessage(m pb.Message, f EntryFormatter) string {
fmt.Fprintf(&buf, "%x->%x %v Term:%d Log:%d/%d", m.From, m.To, m.Type, m.Term, m.LogTerm, m.Index)
if m.Reject {
fmt.Fprintf(&buf, " Rejected")
if m.RejectHint != 0 {
fmt.Fprintf(&buf, "(Hint:%d)", m.RejectHint)
}
}
if m.Commit != 0 {
fmt.Fprintf(&buf, " Commit:%d", m.Commit)
}
if len(m.Entries) > 0 {
fmt.Fprintf(&buf, " Entries:[")
for _, e := range m.Entries {
for i, e := range m.Entries {
if i != 0 {
buf.WriteString(", ")
}
buf.WriteString(DescribeEntry(e, f))
}
fmt.Fprintf(&buf, "]")
Expand Down

0 comments on commit c185bda

Please sign in to comment.