Merge pull request #2345 from bdarnell/normal-entry-formatter

Only use the EntryFormatter for normal entries.
This commit is contained in:
Xiang Li
2015-02-20 11:00:12 -08:00

View File

@@ -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)
}