mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: Improve formatting of DescribeMessage
This commit is contained in:
parent
092879291f
commit
c185bdaf95
@ -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, "]")
|
||||
|
Loading…
x
Reference in New Issue
Block a user