From b53dc0826edee9c229b6ca9d09c7a68235ecb44a Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Fri, 20 Feb 2015 13:51:14 -0500 Subject: [PATCH] Only use the EntryFormatter for normal entries. ConfChange entries also have a Data field but the application-supplied formatter won't know what to do with them. --- raft/util.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raft/util.go b/raft/util.go index 501979e04..0d89405a0 100644 --- a/raft/util.go +++ b/raft/util.go @@ -84,10 +84,10 @@ func DescribeMessage(m pb.Message, f EntryFormatter) string { // Entry for debugging. func DescribeEntry(e pb.Entry, f EntryFormatter) string { var formatted string - if f == nil { - formatted = fmt.Sprintf("%q", e.Data) - } else { + if e.Type == pb.EntryNormal && f != nil { formatted = f(e.Data) + } else { + formatted = fmt.Sprintf("%q", e.Data) } return fmt.Sprintf("%d/%d %s %s", e.Term, e.Index, e.Type, formatted) }